Home >>Laravel Tutorial >Laravel Application Structure
The application structure in Laravel is the composition of folders, sub-folders plus files involved in a project. Once we construct a project in Laravel, we perceive an overview of the application structure.
It is the application folder moreover encompasses the entire source code of the project. It includes events, exceptions and middleware declaration. The app folder contains several subfolders as explained below.
Console incorporates the artisan commands significant for Laravel directory structure.It consists of a directory called Commands, Where all the commands are represented with the proper signature. The file Kernal.php denominates the commands declared in Inspire.php.If we require to request a particular command in Laravel, then we should execute appropriate changes in this directory.
This folder comprises all the functions for the desired project and is used to trigger actions, raise errors or important validations and implement exceptional versatility.Laravel create a database and grasps all the events under one directory. The default file inserted is event.php where all the primary activities are declared.
This folder includes all the methods required to manage exceptions. It also comprises the file handle.php that manipulates all the exceptions.
The Http folder has sub-folders for controllers, middleware plus application calls. As Laravel accompanies the MVC design pattern, this folder involves model, controllers and views determined for the particular directories. The Middleware sub-folder covers middleware phenomenon, including the filter mechanism and interaction linking acknowledgment and Request. The Requests sub-folder incorporates all the requests of the application.
The Jobs directory manages the exercises queued for Laravel application. The base class is assigned among all the Works and gives a central location to install them under one roof.
Listeners are event-dependent. Also, they comprise techniques which are used to control events and exceptions. For instance, the login event represented includes a Login Listener event.
Policies are the PHP classes which involves sanction reasoning. Laravel directory structure consists of a characteristic to generate all authorisation logic within policy classes inside this subfolder.
The Provider folder covers all the co-operation providers needed to register events for kernel servers and to configure a Laravel application.
This directory includes your entire classes needed to send emails, and it is not created by default.
This Bootstrap folder encompasses all the application bootstrap scripts. It includes a sub-folder specifically cache, which provides for all the files correlated for caching a web application. You can further detect the file app.php, which initializes the scripts specified for bootstrap.
The config folder comprises different configurations and associated parameters needed for the constant as well as the smooth functioning of a Laravel application. Several files involved within the config folder are there thus the filenames act as per the functionality connected with them.
laravel create a database, and thus this directory involves several parameters for database functionalities. It involves three sub-directories as given below
Seeds − This includes the classes utilised for the unit measurement database.
Migrations − This folder accommodates in queries for migrating the database utilised in the web application.
Factories −This folder is used to produce a vast abundance of data records.
It is the root folder, assists in initialising the Laravel application. It incorporates the following files and folders
htaccess This file provides the server configuration.
index.php − This file is needed for the initialisation of a web application.
Resources directory includes the files which heighten your web application. The sub-folders incorporated in this directory and their meaning is described below
Assets − The assets folder incorporate files such as LESS and SCSS, needed for styling the web application.lang This folder involves configuration for localisation or internalisation.
Views − These are the HTML files or templates which communicate with end users and play a fundamental function in MVC architecture.
Storage - The storage folder is the folder that collects all the logs and specific files which are often required when a
laravel directory structure project is operating. The sub-folders involved in this directory and their purpose is provided below
app − This folder includes the files known as in succession.
framework − It includes sessions, cache and views which are called repeatedly.
Logs − All exceptions and error logs are traced in this subfolder.
Tests The unit test cases are incorporated in this directory. The description convention for naming test case classes is camel case and comprehends the rule as per the functionality of the class.
Vendor Laravel is entirely based on Composer provinces, for instance, to install Laravel setup or to introduce third-party libraries, etc. The Vendor folder comprises all the composer dependencies.
In extension to the files as mentioned above, Laravel directory structure also incorporates some other data which perform a fundamental role in numerous functionalities such as GitHub configuration, packages and third-party libraries.
.env: It includes environment variables for application and is pretty much crucial for the working environment of laravel directory structure as well as framework files.
.env.example: It also includes environment variables for .application.
.gitattributes: It incorporates as a Git configuration files.
.gitignore: It is also a Git configuration file.
Artisan: It provides you with the working environment that helps empowers you to run Artisan commands.
composer.json: it is a configure file for the composer.
composer.lock: it is also a configure file for the composer.
gulpfile.js: it is the configuration file for Gulp as well as Exilir.
package.json: It is for the frontend, but mostly it is like composer.json.
phpunit.xml: It is a configuration file for PHPUnit
readme.md: It includes general information about the framework.
server.php. It works as an internal web server and has a primary role in framework working environment.
So we have finish the 4th Session of laravel tutorial now click in Next Page