To install Laravel on your local development environment, follow these steps:
Install PHP: Laravel requires PHP to be installed on your system. You can download PHP from the official website (https://www.php.net/downloads.php) and follow the installation instructions for your operating system.
Install Composer: Composer is a dependency manager for PHP that Laravel uses. Download and install Composer from the official website (https://getcomposer.org/download/).
Verify PHP and Composer installation: Open a command prompt or terminal window and run the following commands to verify the installation:
php --version
composer --version
If the commands display the PHP and Composer versions, respectively, it means the installations were successful.
Install Laravel: Open a command prompt or terminal window, navigate to the directory where you want to install Laravel, and run the following command:
composer global require laravel/installer
This will download and install Laravel globally on your system.
Add Laravel to PATH (optional): If you want to access the Laravel command-line tool globally without specifying its full path, you can add the Composer global bin directory to your PATH environment variable. The exact steps for doing this depend on your operating system.
Create a new Laravel project: Navigate to the directory where you want to create your Laravel project, and run the following command:
laravel new project-name
Replace "project-name" with the desired name of your project. This command will create a new Laravel project in a directory with the specified name.
Start the development server: Navigate into the newly created project directory using the following command:
cd project-name
Then, run the following command to start the development server:
php artisan serve
This will start a local development server at http://localhost:8000
, where you can access your Laravel application.
That's it! You have successfully installed Laravel on your local development environment. You can now start building your Laravel application.