Getting Started With Laravel 5.4: Basic Concepts & Installation on Localhost

by Ahmed Khan  February 2, 2017

This is the first part of a beginner’s series on Laravel. In this part, I will give a basic introduction of Laravel and the new features introduced in Laravel  5.4. I will also discuss how you could install Laravel 5.4 on localhost (your local machine). Laravel 5 comes with a revamped of directory structure and several new features that have greatly improved the process of code development.

I highly recommend Laravel as the first PHP framework for beginners because of the simplistic style of code development. Check out this simple snippet:


The Laravel Architecture

Like all popular PHP frameworks such as Symfony, Yii, Codeigniter and others, Laravel is a MVC framework. Given this important point, it is important that you should understand the concept of MVC architecture. MVC stands for Model, View and Controller. It is an application architecture model which separates an application into three logical components:

  • Model: This component handles all the logic of the application
  • View: This component handles all the UI and presentation elements of the application
  • Controller: This component act as the interface between Model and View. This is where the business logic is processed.  

Let’s see how Laravel 5.4 implements the MVC architecture in its directory structure.

Laravel 5.4 controllers

The app folder in the Laravel contains the Models and Controllers of the application. Models are created in the root of the app folder, where as Controllers and Middlewares are created in their respective folders inside the Http folder. Views in Laravel are created in views folder inside the resources folder. Routing for for controllers is handled by the Web.php file located inside the  routes folder.

In order to run your app, you need to go to the public folder of your Laravel application.  

Basic Components of Laravel 5

Laravel comes with many components which streamline application development and ensure that the app is up and running in minimal time. Some important Laravel 5 component are:

  • Routing
  • Requests
  • Response
  • Middleware
  • CSRF Protection
  • Validation
  • Authentication
  • Authorization
  • Eloquent ORM
  • Responses
  • Laravel Dusk
  • Filestorage
  • Artisan

I will discuss several of these components in the upcoming instalments of this series. Check out the new features in Laravel 5.4.

Install Laravel 5.4 on Localhost

Before installing Laravel on localhost, make sure that Composer and local server tools like MAMP/WAMP/XAMPP are installed on the system. The system requirements for Laravel:

  • PHP >/= 5.6.4
  • OpenSSL PHP extension
  • PDO PHP extension
  • Mbstring PHP extension
  • Tokenizer PHP extension
  • XML PHP Extension

You have two options for installing Laravel.

The first method is through Laravel installer.

On the command line, type the following command:

composer global require "laravel/installer"

laravel command line

This command will install Laravel Installer. The most important benefit of Laravel Installer is the ease of starting new projects. A new Laravel project could be easily created by a single, easy-to-remember command. I will now use this command to create a new project:

laravel new blog

laravel new blog

Once the command finishes, a new Laravel project, with name blog will be created.

The second method of installation is through Composer create-project command.

In the root directory, create a new folder and name it laravel. Now on the command line, go to the laravel folder and use the following code to install Laravel.

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

laravel 5.4 installation

Once the installation finishes, a new project with name blog will be created.

At this point, you have a working installation of Laravel on the local host. To test the integrity of the installation, launch the browser and go to localhost/blog/public.  You will see the following:

Laravel homepage

You can also test the Laravel installation by running its own server. On the command line, go to the project’s directory and run the following command:

php artisan serve

php artisan serve

The command will launch the built-in Laravel development server.


In this first installation of the series on Laravel 5.4, I introduced Laravel 5.4 and its basic architecture. I also discussed how you could install Laravel 5.4 on localhost. In the upcoming parts, I will elaborate on several features and aspects of Laravel 5.4.

Create Laravel apps without the worry of server management.

Deploy your app on optimized PHP hosting servers for Laravel.

About Ahmed Khan

Ahmed was a PHP community expert at Cloudways - A Managed PHP Hosting Cloud Platform. He is a software engineer with extensive knowledge in PHP and SEO. He loves watching Game of Thrones is his free time. Follow Ahmed on Twitter to stay updated with his works. You can email him at

Stay Connected:

You Might Also Like...