Any framework application has its own directory structure. Laravel also has its own directory structure. This directory structure tells here how to do the work in this framework or what file should be kept. So that developers and programmers have no problems in working with these frameworks and developing web applications.
If you are learning or working with laravel framework. You must know about the laravel application directory structure. It will contain many folders in it. You can see the below in Image
You can see above the larva application directory structure image. Each of the folders and files in the above image and overview serves a specific function for the overall functioning of the larval structure. The purpose of each of these folders is to display below, but first, let's take a look at their overview once:
Laravel Application Directory Structure
Let's see the overview of laravel application directory structure below:
- app directory
- bootstrap directory
- config directory
- database directory
- public directory
- resources directory
- routes directory
- storage directory
- tests directory
- vendor directory
This directory is the main folder of the laravel framework. It contains all the main code files of our web application like Controllers, Models, Middlewares, Exceptions, Console, Providers, Custom Artisan Commands etc. This directory further contains many sub-directories like you can see below:
||Uses of directory
||This directory holds Artisan commands. You can create a custom artisan command using the php artisan make:command command.
||This directory holds the exception handling files. Here also, you can create your own specific exceptions handing the file to be thrown by our application.
||This directory holds controllers, middleware, and kernal.php. Almost all of the backend to handle requests entering our application will be placed here.
||This directory holds all the service providers for the application. Service providers bootstrap our application by making services available to us by registering them.
||By default, this directory is not there.But You can create using php artisan make:channel command. It holds all the broadcast channel classes for our web application to broadcast your events.
||By default, this directory is not there. But You can create using php artisan make:event command. This directory contains event classes that can be used to give signals to other parts of the application or vice-versa.
||By default, this directory is not there. But You can create using the php artisan make:job command. This directory contains lineup jobs for our application.
||By default, this directory is not there. But You can create using the php artisan make:listener command. This directory holds the classes that handle our events.
||By default, this directory is not there. But You can create using the php artisan make:mail command. This directory holds all of our classes that represent emails sent by the web application.
||By default, this directory is not there. But You can create using the php artisan make:notification command. This directory holds all of the “transactional” notifications that are sent by our application.
||By default, this directory is not there. But You can create using the php artisan make:policy command. This directory holds the authorization policy classes which are used to determine if a user can access or change specific data or not.
By default, this directory is not there. But You can create using the php artisan make:rule command. This directory holds the self-created validation rule objects which are used to encapsulate complicated validation logic in a simple object.
This directory holds app.php file and cache directory which is used to store framework generated files for performance optimization.
The config directory holds all the application configuration files like database, mail, session, services file etc.
This directory holds database migrations, model factories and seeds files.
This directory holds the frontend template files of the web application and also holds language (localization) files, sass files.
This directory holds all the routing files of the your web application web.php, console.php, api.php, channels.php etc.
This directory holds the session files, cache files, compiled Blade templates, and other files generated by framework.
This directory holds all of your automated tests which are required to ensure that the application is working as per expectations or not.
This directory holds all the dependencies downloaded through Composer or Package files.