Laravel is one among the top PHP frameworks used today for the web development. May it be developing dynamic websites with multiple modules or collection of REST APIs for a mobile app, you will always find Laravel at top choices.
Though i am writing up this series of posts on Laravel 5.2 , greater version have been released. To start with Laravel, you need to have some good knowledge of Object Oriented Programming in PHP. Laravel depends on Composer for installing all it’s dependencies(packages).
If you are not familiar of composer you can visit here and install it as per it’s documentation. It’s pretty simple. Once you install the composer, you can have access to repository of PHP & Laravel packages and install them in your project easily.
To start with the Laravel you require PHP on your machine. For Laravel 5.2 the minimum version for PHP should be 5.5.9 or above. You can check this on your console :
Lets start with the set up of laravel.
Execute the create project command to install laravel
composer create-project laravel/laravel myapp "5.2.*"
It will take few mins to download laravel and all it’s dependencies to your folder.
Using console enter in this directory.
Lets discuss these files and folder pulled by composer .
app – This is the main section of your application. It contains all Controllers, Providers and Middleware
config – As the name suggests it stores all configuration files.
database – This contains migrations used to create your tables in database. Migration for users table would already be set.
vendor – This folder will contain all the dependencies. If you are a newbie (which you are ) so no editing to be done directly in this folder and sub folders.
public contains the files that are to be accessed via browser like scripts, css and images
.env file – This is called as envoirnment file and is required for storing all configs which are required for setting up project envoirnment.
composer.json contains all the dependencies list that is required by your application. Later any more dependencies you require in your application can be added to this file or pulled using below command.
composer require <<vendor>> / <<package-name>>
Laravels bring inbuilt web server and you can use it for running your application. Open your terminal and use
php artisan serve
This will run your web server on default port 8000. If you wish to run on other port number use switch port
php artisan serve --port=8080
Access the application in browser
Congratulations if you can see a Laravel 5 Logo on default welcome screen.
We will come with setting up database in next article.