How to set-up Laravel Command on Ubuntu

How to set-up Laravel Command on Ubuntu

This time we suggest you go over our developer's manual to setting-up Laravel Command on Ubuntu. We hope you find this useful! Let's get right into it!

There are two ways to create a new Laravel project:

  1. using the Composer create-project command in a terminal:
  composer create-project --prefer-dist laravel/laravel newProject
  1. using the laravel command:
laravel new blog

Starting with the second method, I would like to mention that the command is quite simple and easy to remember. But the question is how to set up the Laravel Installer correctly?
First of all you need to download it using the following command:

composer global require laravel/installer

According to documentation you should place Composer's system-wide vendor bin directory in your $PATH so the laravel executable can be located by your system․ This directory exists in different locations based on your operating system. Next step is to find the correct address and location to place it. You can run the command:


composer global about

and see the address there.

In my case, as you see, this is $HOME/.composer.

To place it in the PATH variable, you need to open the .bashrc file and add the following line at the end: export PATH=$HOME/.composer/vendor/bin:$PATH 

After reloading your terminal, the Laravel command will be available, and you can create a new project via command laravel new blog command.

Congratulations, now laravel command is running in your system!