Laravel - Application Directory Structure

By default, the directory structure of Laravel is meant to meet the requirement for both large and small application development. But there is a provision to organize your application according to the way you like. Laravel doesn't put up any compulsion and restriction on locating your given class anywhere - providing the composer can is free to load that class automatically. So in this chapter, you will be learning about the two different directories of Laravel. So let us dig deep into it.

The Root Directory Structure of Laravel

This directory is one of the most important directories inside which you will find some other subdirectories. These are:

routes storage

appThe app directory holds the base code for your Laravel application.
bootstrapThe bootstrap directory contains all the bootstrapping scripts used for your application.
configThe config directory holds all your project configuration files (.config).
databaseThe database directory holds your database files.
publicThe public directory helps to start your Laravel project and maintains other necessary files such as JavaScript, CSS, and images of your project.
resourcesThe resources directory holds all the Sass files, language (localization) files, templates (if any).
routesThe routes directory contain all your definition files for routing, such as console.php, api.php, channels.php, etc.
storageThe storage directory holds your session files, cache, compiled templates as well as miscellaneous files generated by the framework.
testThe test directory holds all your test cases.
vendorThe vendor directory holds all composer dependency files.

The App Directory Structure of Laravel

This is another Laravel directory that holds other subdirectories for additional purposes. These are:

ConsoleThe Console directory contains all your project artisan commands.
EventsThe Events directory holds event files that your laravel application may pop up. Events are used for sending messages or signals to other parts of the laravel project that any action had taken place within the project.
ExceptionsThe Exceptions directory holds your laravel project's exception handling files, which handles all the exceptions thrown by your Laravel project.
HttpThe Http directory holds different filters, requests, and controllers.
JobsThe Jobs directory holds all lineup jobs in this directory. But it does not get created initially; instead, you need to type and run this artisan command:
ListenersThe Listeners directory holds all your project's handler class for which are used for receiving and handling events.
MailThe Main directory holds all the emails send by through your Laravel project, and this directory needs to be created using the command:
NotificationsThe Notifications directory contains all your transactional notifications sent through your Laravel project, and this directory needs to be created using the command:
PoliciesThe policies directory holds different policies for your laravel project.
ProvidersThe Providers directory is used for containing different service providers.
RulesThe Rules directory hold all the different objects related to custom validation rules, and this directory needs to be created using the command:

Scroll Back to Top