How to install Laravel 7, 8, 9 by composer

04 Dec
2022

Server Requirement:

The Laravel framework has a few system requirements. If you are installing laravel 7. If you are trying to install Laravel by composer then it will automatically pick the laravel version according to your PHP version. But you can specify the version while installing it using composer.

  • PHP >= 7.2.5
  • BCMath PHP Extension
  • Ctype PHP Extension
  • Fileinfo PHP extension
  • JSON PHP Extension
  • Mbstring PHP Extension
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Step 1:

Visit the following URL and download composer to install it on your system.
https://getcomposer.org/download/

Note: In case, the composer already installed your system then you don’t need to run the first step.

To verify composer is installed or not, by running  composer the command in terminal/cmd

Step 2:

You can install a specific version using the following command. Just need to change the version in place of 7.0

composer create-project --prefer-dist laravel/laravel:^7.0 blog

Install laravel according to the installed PHP version in your system by the following command.

composer create-project --prefer-dist laravel/laravel blog

It will take few minutes according to your internet speed.

Note: the blog is your folder/directory name, So you can change it as per your choice.

Output:

Step 3:

First, you need to go blog directory by the following command.

cd blog

Start the Laravel service by executing the following command. This command will start a development server at http://localhost:8000

php artisan serve

Output:

Copy the URL from the terminal http://127.0.0.1:8000 in the above screenshot and open that URL in the browser. If you see the following screen, it implies Laravel has been installed successfully.

Note: 
The above screenshot URL might be different in your case so use them. Also, the Web screen may be different for you due to the different versions of Laravel.

Output:

Leave a Reply

Your email address will not be published.