When you will create your fresh Laravel application, it will contain a large number of folders as shown in image below:
Each of these folders fulfils a specific task for the overall functioning of the framework. The purpose of each of these folders is explained below but before that let’s look at each of them once:
- app directory
- bootstrap directory
- config directory
- database directory
- public directory
- resources directory
- routes directory
- storage directory
- tests directory
- vendor directory
Purpose of each of these directories:
- app direoctory: This directory is the heart of the framework and backend developers mostly work on this directory. It contains all the backend code of our web application like Controllers, Broadcasts, Providers, Custom Artisan Commands, Middlewares etc. This directory further contains many sub-directories like shown in the image below:
The App Directory:
Directory Purpose Console This directory contains all Artisan commands which are created by us. These commands can be generated using the php artisan make:command command. Exceptions This directory contains the application’s exception handling files. Here you can create your own specific exceptions to be thrown by our application. Http This directory contains our controllers, middleware, and form requests. Almost all of the backend to handle requests entering our application will be placed here. Providers This directory contains all of the service providers for the application. Service providers bootstrap our application by making services available to us by registering them. Broadcasting This directory is not there by default but can be created by using the php artisan make:channel command. It contains all of the broadcast channel classes for our application to broadcast your events. Events This directory is not there by default but can be created by using the php artisan make:event command. This directory contains event classes which can be used to give signals to other parts of the application or vice-versa. Jobs This directory is not there by default but can be created by using the php artisan make:job command. This directory contains lineup jobs for our application. Listeners This directory is not there by default but can be created by using the php artisan make:listener command. This directory contains the classes that handle our events. This directory is not there by default but can be created by using the php artisan make:mail command. This directory contains contains all of our classes that represent emails sent by application. Notifications This directory is not there by default but can be created by using the php artisan make:notification command. This directory contains all of the “transactional” notifications that are sent by our application. Policies This directory is not there by default but can be created by using the php artisan make:policy command. This directory contains the authorization policy classes which are used to determine if a user can access or change a specific data or not. Rules This directory is not there by default but can be created by using the php artisan make:rule command. This directory contains the self-created validation rule objects which are used to encapsulate complicated validation logic in a simple object.
- bootstrap directory: This directory contains app.php from where the whole framework bootstraps. This directory also contains the cache directory which is used to store framework generated files for performance optimization.
- config directory: This directory contains all the configuration files related to database, mail, session, services etc.
- database directory: This directory contains database migrations, model factories and seeds.
- resources directory: This directory contains the frontend of the application. All the HTML code which make the frontend of application is present here in the form of Blade templates which is a templating engine Laravel comes with.
- routes directory: This directory contains all the route definitions of the application.
- storage directory: This directory contains the compiled Blade templates, file based sessions, file caches and other files generated by framework.
- tests directory: This directory contains all of our automated tests which are required to ensure that the application is working as per expectations or not.
- vendor directory: This directory contains all the dependencies downloaded through Composer needed by our framework.
- Laravel | Artisan Commands to know in Laravel
- Copy the entire contents of a directory to another directory in PHP
- Laravel | Migration Basics
- Laravel | Routing Basics
- Laravel | Controller Basics
- Laravel | View Basics
- Laravel | CSRF Protection
- Laravel | Validation Rules
- Differences Between Django vs Laravel
- Laravel | Delete Records
- Laravel | Front-end Scaffolding
- Laravel | Installation and Configuration
- Laravel | Eloquent Model Basics
- Difference Between Laravel and CodeIgniter Framework in PHP
- Difference Between Laravel and Ruby on Rails
- Laravel | MySQL Database Connection
- Laravel | Artisan Console Introduction
- Laravel | Blade Templates Inheritance
- What are the differences and Similarities Between Lumen and Laravel?
- Different ways for passing data to view in Laravel
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.