How to use composer to install Laravel

Laravel is a web framework that is based on PHP and can be easily installed & use on Windows, Linux or macOS using PHP Composer, Dependency Management tool for web development.

This is a simple PHP web framework that helps in building web apps without messy codes and highly documented which mitigates the hurdles of developers very much. However, its syntax is elegant, and many methods can be deduced directly without looking at the documentation.

Laravel is completely open-source. All code is available on Github, and you are welcome to contribute your own power. Furthermore, Laravel’s package repository is quite mature, and it can easily help you install bundles into your application. You can choose to download a bundle and copy it to the bundle’s directory or install it automatically through the command line tool called “Artisan”.

Laravel installation requirements:

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP Extension

Use Composer to install Laravel web framework


In this tutorial, we will see the steps of Composer to install Laravel on any system running on Windows, Linux or macOS, however, make sure the PHP and Composer are installed on them.

Laravel installer


Command to install Larvel using composer globally for the system.

composer global require laravel/installer

Let’s initialize a Laravel project using composer:

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

You can change the demoh2s with your project name.

Now, let’s use the integrated web server in the project to see the Laravel demo page.

Switch to the directory fo the project you have created, for example here we have demoh2s

cd demoh2s

Now, run the command line tool artisan us the PHP command:

php artisan serve

Now, open the browser and point it to http://127.0.0.1:8000

If everything goes well, you will see the demo page of Laravel

Use Composer to install Laravel web framework