How to install Laravel 10

How to install Laravel 10

How to Install Laravel 10

Laravel is a powerful PHP framework that allows developers to build robust web applications quickly. This guide will walk you through the process of installing Laravel 10 on your local machine.

Prerequisites

Before you begin, make sure you have the following installed:

  • PHP: Laravel 10 requires PHP 8.1 or higher.
  • Composer: A dependency manager for PHP.
  • Database: (Optional) You may need a database server like MySQL or PostgreSQL, depending on your application requirements.

Step 1: Install PHP

If you haven’t installed PHP yet, you can use Homebrew to install it on macOS. Open your terminal and run:

brew install php

Verify your PHP installation:

php -v

Step 2: Install Composer

Composer is essential for managing Laravel dependencies. If you haven't installed Composer, run the following commands:

curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer

Check if Composer is installed:

composer -V

Step 3: Create a New Laravel Project

You can create a new Laravel 10 project using Composer. Navigate to the directory where you want to create your project and run:

composer create-project --prefer-dist laravel/laravel my-laravel-app "10.*"

Replace my-laravel-app with your desired project name.

Step 4: Change to Your Project Directory

Once the installation is complete, navigate to your project directory:

cd my-laravel-app

Step 5: Configure Your Environment

Laravel uses a .env file to manage environment configurations. Open the .env file in your project directory to configure your database and other settings:

nano .env

Make any necessary changes (such as database configuration) and save the file.

Step 6: Generate Application Key

Laravel requires an application key, which you can generate using the following command:

php artisan key:generate

This command sets the APP_KEY value in your .env file.

Step 7: Run Your Application

Laravel includes a built-in development server. Start the server with the following command:

php artisan serve

You should see an output indicating that your application is running. By default, it will be accessible at:

http://127.0.0.1:8000

Open this URL in your web browser, and you should see the Laravel welcome page!

Conclusion

🎉 Congratulations! You have successfully installed Laravel 10. You can now start building powerful web applications using this amazing framework.

💬 If you have any questions or need further assistance, please ask!

API Sample

Souy Soeng

Souy Soeng

Our website teaches and reads PHP, Framework Laravel, and how to download Admin template sample source code free. Thank you for being so supportive!

Github

Post a Comment

CAN FEEDBACK
close