As Laravel is becoming a glooming framework now with PHP, I would like to add a small introduction to Laravel along with basic installation steps.
First thing to do before starting with Laravel is we need to install composer. Composer is a dependancy management tool, which will manage the libraries which we need to include by itself (install/update library).
Please find the below link to do the installation of composer,
To verify whether composer is properly installed in your system, follow the below steps,
- Open Command prompt,
- Type the command “composer -V”
You should see the composer version something like below,
Composer version 1.1.3 2016-06-26 15:42:08
Why composer is required in Laravel?
You can install Laravel using composer as below,
In Laravel package we have a file called “composer.json” in the root directory, which will be having the list of dependancy files which needs to be included.
For manually installing Laravel doanload the laravel package and put it in any desired directory you need your project to be in and do follow the below commands to install it.
php composer.phar install
Setting up basic Environment Settings:
Once the dependancy files are updated. You can setup your environment by creating the .env file, which will be available in laravel root directory as “.env.example”. Just rename it to “.env” and change the necessary values in it.
First thing to change in it is the APP Settings,
Define thhe APP_ENV, APP_URL as required.
APP_KEY – This key should be generated by running the below command,
php artisan key:generate
This will give you a key and it will be updated in the .env file.
NOTE : Make sure you have the .env file in your directory
Then you can create database and update the database details, cache, mail, etc in the .env file. Now you are ready to go with Laravel.
In next post you can learn about the basics of how Laravel works and how the interaction happens in the framework.