The very first time that I installed Laravel was really tedious, I didn’t know what was composer, I remember that searched where to download Laravel, The other framework that I used before was CodeIgniter.
The first thing you want to do is downloading it, but that thing doesn’t exist here. The First thing you need to do is install Composer and follow the steps to install it. You can check how to install composer.
Generally, I use git bash that comes with git installation, it becomes easier to use Laravel commands or composer commands if you are in Windows OS.
Prior to installing Laravel, you need to check if you match the requirements. The next step is install it via composer
composer global require "laravel/installer"
On Windows, we do have not to do anything else. You can use laravel new <project_name> command
Linux AND macOS
After this we have to add the path of our folder on the PATH, some places where you can find this folder are:
- macOS: $HOME/.composer/vendor/bin
- GNU / Linux Distributions: $HOME/.config/composer/vendor/bin
PLZ: check it first before executing commands, and make a backup of your PATH, you can easily obtain your PATH with echo $PATH save it in a file so if you have to restore you can use it.
In Linux Mint for example you can make this by editing .bashrc file, you can execute cd — and nano .bashrc, finally add the following line to your file and save it:
Continuing, you have to refresh your .bashrc with source .bashrc command in console.
Creating new Project
Now, if all is ok, you could use:
laravel new myblog
This code creates a directory called myblog(it’s just a name, you can use the name what you want) with a new installation of Laravel. Another way to do this is using composer.
composer create -project --prefer-dist laravel/laravel myblog
Being in the folder, we can check if it’s working:
php artisan serve
Let’s go to the browser and put http://localhost:8000, if all is ok you will obtain the classic Laravel welcome screen
You may be interested in laravel homestead.