Laravel Installation : Application Structure (Part 2)

Hi they, in our previous tutorial we learn how to install and serve laravel application. In this edition will we be looking at laravel application structure.

Laravel application structure is basically the structure of folders, sub-folders and files included in a project. Once a project is initiated in Laravel, we get an overview of the application structure as shown in the image below

Application structure

 

Below is some of the breakdown of folders and files, along with their function.


app
This is the application folder; this folder includes the entire source code of the project. It contains events, exceptions and middleware declaration. The app folder comprises various sub folders such as;

  • Console

The console folder includes the artisan commands necessary for Laravel. It includes a directory named Commands, where all the commands are declared with the appropriate signature. The file Kernal.php calls the commands declared in Inspire.php.

  • Events

This directory contains all the events for the project. Events are used to trigger activities, raise errors or necessary validations and provide greater flexibility. Laravel keeps all the events under one directory. The default file included is event.php where all the basic events are declared.

  • Exceptions

This directory contains all the methods needed to handle exceptions. 

  • Http

The Http folder has sub-folders for controllers, middleware and application requests

  • Jobs

Job folder maintains the activities queued for Laravel application.

  • Listeners

Listeners are event-dependent and they include methods which are used to handle events and exceptions.

  • Policies

Policies are the PHP classes which includes the authorization logic.

  • Providers

This contains all the service providers required to register events for core servers and to configure a Laravel application.

bootstrap
The bootstrap folder encloses all the application bootstrap scripts. 


config
Config folder includes various configurations and associated parameters required for the smooth functioning of a Laravel application. 


database
As the name implies, this directory includes various parameters for database functionalities. It includes three sub-directories namely;

  1. Seeds: This contains the classes used for unit testing database.
  2. Migrations: This folder helps in queries for migrating the database used in the web application.
  3. Factories: This folder is used to generate large number of data records.


Public
This is the root folder which helps in initializing the laravel application. It includes the following files and folders: 

  1. .htaccess: This file contain the server configuration.
  2. javascript and css: These considered as assets.
  3. index.php: This file is required for the initialization of a web application.


resources
Resources directory contains the files which enhances your web application. The sub-folders included in this directory and their purpose is explained below:

  • assets: The assets folder include files such as LESS and SCSS, that are required for styling the web application.
  • Lang: This folder includes configuration for localization or internalization.
  • Views: Views are the HTML files or templates which interact with end users and play a primary role in MVC architecture.


storage
This folder stores all the logs and necessary files which are needed frequently when a Laravel project is running


tests
This is where all unit test cases are. 


vendor
The Vendor folder includes all the composer dependencies.


That is where we stop for this edition. In our next tutorial we will start building our CRUD system. We will be building a product store. 


Thanks see you in next edition.

Post a Comment

0 Comments