Let us set up a basic Laravel App

Do not miss this exclusive book on Binary Tree Problems. Get it now for free.

Reading time: 15 minutes | Coding time: 5 minutes

Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model–view–controller architectural pattern. Laravel is considered as one of the best PHP framework due to its technical advantages.

  • Laravel framework makes implementations of authentication very simple.
  • Laravel provide object oriented libraries.
  • Laravel supports MVC architecture pattern.
  • Database Migration is easy.

To get start with Laravel, following requirements needs to be fulfilled:

  • 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

Step 1:
Visit the following URL and install Composer on your local machine.

https://getcomposer.org/download

Note:

Composer is a tool for dependency management in PHP. It allows to declare the libraries which the projects depends on and it will manage the installations and updates

Step 2:

Make sure the composer is installed properly by typing 'composer' command in command prompt.

composer

Output:

Step 3:

Create a directory anywhere in your machine and move to that folder in command prompt and type the below command to create a new Laravel project

composer create-project laravel/laravel –-prefer-dist

Step 4:

After the project is created,move to that folder and type the below command to start the Laravel service

php artisan serve

Note:

Artisan is the command-line interface included with Laravel. It provides a number of helpful commands that can assist while developing the application.

Example: To create a controller, type:

php artisan make:controller <controller_name>

We will cover this idea of controller in a later article

After executing the above command you can see the following URL

Step 5:

Copy the URL displayed in command prompt and open it using a browser. It will display this screen

In case the command php artisan serve not worked, then try by using the below command

php -S localhost:8000 -t public/

Happy Coding :)

Sign up for FREE 3 months of Amazon Music. YOU MUST NOT MISS.