Laravel App Structure

Hello friends after successful installation of laravel let’s have a look at the Application structure of Laravel. The application structure refers to the folders, sub-folders and files that are required in the project.

App Folder

The App folder contains most of the code of the project. This is one of the important folder in laravel project. Following are the sub-folders in app folder.

  • Console
  • Exceptions
  • Http
  • Models
  • Providers

Console

Console folder incorporates all the artisan commands required for laravel application. It contains a folder called commands where all the commands are stored with signature. If we need to request a specific command in Laravel we need to make changes in this folder.

Exceptions

This folder contains all the methods used to handle exceptions thrown by laravel application. It contains the file handle.php that handles all the exceptions.

Http

The Http folder contains sub-folders called controllers, middleware and also contains application calls. Since laravel is based on MVC structure http folder stores controllers, models and views. The Middleware folder includes the filter mechanism and handles communication between request and response. All the requests are processed through middleware. The request sub-folder stores all the application requests.

Providers

The provider folder contains all the service providers required to register events and to configure laravel application.

Bootstrap Folder

The bootstrap folder includes all the files that are used to bootstrap the laravel appliation and configure auto-loading. The bootstrap folder contains a sub-folder cache which is used for caching a web application. Bootstrap folder also contains a file app.php which is used to initialize the script required to bootstrap laravel appliation.

The below screen shows the contents of bootstrap folder.

Config Folder

The config folder stores all the configuration files used in laravel application. We can configure laravel settings by making changes in these files. The config folder includes files for database configuration, mail configuration and many more. Each file in this folder has its own purpose.

Database Folder

The database folder contains database files. Following are the sub-folders inside the database folder.

  • Migrations – Used to Migrate the database in the application.
  • Factories – Used to generate large number of records.
  • Seeds – Used to store Unit Testing Classes.

Public Folder

It is a root folder of the application. The public folder contains controllers used to initialize the laravel application. Following are the contents inside the public folder.

  • .htaaccess– This file is used for server configuration.
  • Javascript and CSS:– These files are the assets of the application.
  • Index.php– This file is a starting point from where application is initialized.

Resource Folder

The resource folder is used to enhance the web application. Following are the sub-folders in the resource folder.

  • Assets– This folder contains files that are used for styling web application. e.g css scss etc.
  • Lang:– Lang folder contains files to configure localization and internationalization.
  • Views– The view folder contains html Files that are used to display to the user. This view is V in the MVC pattern.

Storage Folder

The storage folder contains files that are required in runtime of the laravel application. Following are the sub-folders in the storage folder.

  • App– This folder contains files that are called in succession.
  • framework :– This folder contains sessions, cache and views that are called frequently.
  • Logs– This folder tracks error logs and exceptions thrown by the application.

Tests Folder

The tests folder contains Unit Test cases. The naming convention for naming test case classes is camel-case but we need to follow the naming rule according to class functionality.

Vendor Folder

The vendor folder contains the composer dependencies. To install laravel we need composer. The vendor folder stores all the dependencies of the composer.

In this way the laravel application architecture consists of several folders and sub- folders to store contents and configure application settings.

About the Author: allcodebuzz

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *