Laravel framework needs a few requirements for getting installed on your system. A virtual machine has fulfilled each of these system requirements, Laravel's Homestead; hence, it is necessary to implement Homestead as the Laravel development environment for your local system.
Moreover, in case you do not use this virtual machine, you must fulfill the following requirements:
- PHP having version 7.0 or upper version
- An OpenSSL extension for PHP
- A PDO extension for PHP
- Mbstring extension for PHP
- Tokenizer extension for PHP
- XML extension for PHP
Laravel implements a composer for managing dependencies within it. Hence, before using Laravel, it needs to check whether you have a composer set up on your system or not.
If you don't have Composer installed on your computer, first visit this URL to download Composer:
When installing the Composer, cross-check whether it is installed or not by typing in the composer command prompt. You can see the Composer screen in that CMD only.
It needs to be kept in mind to put the Composer's system-wide vendor in the bin directory within your
$PATH; as a result, your system can locate the executable of laravel. Depending on which operating system you are using, this directory will exist. Still, for PCs having OS like MAC and Linux, it will be:
Linux OS: $HOME/.config/composer/vendor/bin
Setup Laravel using Installer
First of all, you have to download the Installer of Laravel with the help of Composer, like this:
composer global require "laravel/installer"
When the installation is done, a
new command of laravel will start a fresh installation in the directory you have provided.
laravel new nirectory_name
Create a Project
The next thing you have to do is make a new folder in some specific path within your system for keeping your Laravel projects. Move to that location where the directory is created. For installing the Laravel, the following command you have to type:
composer create-project laravel/laravel - prefer -dist
The command mentioned above will make Laravel installed on that specific directory. Type the following command:
php artisan serve
The above code will start the Laravel service. A black screen will appear showing the message: Laravel Development server started on http://localhost:8080. Copy and paste: http://localhost:8080 in your browser, and you can see the Laravel home screen appears in your browser.