Laravel From Scratch

Introduction

Laravel is a strong PHP MVC framework to develop Web Applications. It was developed to face the challenges that occurred in CodeIgnitor. It was created by Taylor Otwell. Laravel provides a simple toolkit for developers to build web applications.

Before proceeding, you should be well versed with HTML,CSS,Core PHP. Here, we will be learning Laravel 5.1.

Laravel is one of the best open source frameworks so far, which includes the features of all other application frameworks, such as Codeignitor, YII, ASP.Net, MVC, Ruby on Rails etc. Laravel has a rich set of features, which helps in improving the speed of web development. Building Applications with Laravel has a great feature of security. You will be secure with your websites. It will protect your websites from all attacks.

Features of Laravel

  • Routing
  • Configuration Management
  • Template Engine
  • E-mailing
  • Query Builder & ORM(Object Relational Mapper)
  • Queues
  • Authentication
  • Schema Builder,Migrations
  • Modularity
  • Testability
Installation

We will be installing Laravel, using the composer.
  • Visit here and download the composer.

  • After the composer is installed, check its installation in the Command Prompt.


    Fig: Check Composer Installation

  • As soon as you see the composer installed in your system, create a directory in your system.

  • Now in the command prompt; jump to the path where you have created the directory. Copy the following line of code and paste in the command prompt.

    “composer create-project laravel/laravel laravel5.0 5.0 –prefer--dist”


    Fig: Run Install Command

    After putting the following line of code in the command prompt, the installation of Laravel will start.


    Fig: Installation Process
Wait for some time, the installation will take minutes. After the installation completes, you can now access the site, using your localhost.


Fig:  Root Directory Architechture

When you will enter the URL in your Browser, the screenshot will appear. Click Public to see the installation of Laravel.

  • Now, Laravel framework has been installed onto your system.
Root Directory

The root directory of Laravel contains various files and folders.
 
  • app: This folder contains the main code of the Application.
  • bootstrap: It contains the bootstraping Script of the Application.
  • config: It contains the configuration files of the Application.
  • database: It contains the database migration and seeds.
  • public: It contains the front controller and the assets (images,CSS & JavaScript).
  • resources: This directory contains your views, raw assets, localization files and the templates; that are rendered as HTML.
  • storage: This file contains the app storage like file uploads, app generated logs and the framework storage(Cache files).
  • test: This file will contain the various test cases.
  • vendor: This file contains your composer dependencies.
App Directory

The App Directory contains the main materiel of your project. It contains following sub-directories.
  • console: All the artisan commands are stored in the console.
  • http: It contains the controllers,middlewares(filters) and requests.
  • events: This directory contains the events that our Application can raise. The events are used to alert the Application, whenever any action occurs, which provides a great deal of flexibility and decoupling.
  • Providers: This directory contains various Service providers.
  • Exceptions: The exception directory contains the Application’s exception handler and it is also a good place to stick any exception thrown by your Application.

Conclusion

After reading this article, you will understand the basic architecture of Laravel.

Up Next
    Ebook Download
    View all
    Learn
    View all