Laravel Directory Structure contains many folders, sub-folders & files. when we download laravel project this whole directory structure of laravel downloaded automatically as a project.
Laravel Root Directory Structure
Below given snapshot show you root the main folder of laravel project which contains many folders, sub-folders & files. All folders and files explanation is given below.
This Laravel root directory is the main directory that contains many other directories.
In snapshot “MATCH4U” is the Laravel project name your project name might be different.
|app||The app directory is a base directory that contains Controller, Middleware, Exception, Event, etc.|
|bootstrap||The bootstrap directory contains all bootstrap scripts that are useful for your web application. it contains subfolders called cache to use caching mechanism.|
|config||The config directory holds configuration files to configure laravel web application.|
|database||The database directory contains all required database files.|
|public||The public directory is the main root directory which is used to start your laravel application. it contains all required assets like CSS, JS, Images, etc.|
|resources||The resources directory holds files which use to make an advance web application, Which contains Saas files, Lang, Views.|
|routes||The Routes directory includes files for routing such as console, API, channels, web, etc.|
|storage||The storage directory contains files for the session, cache, log, and other miscellaneous files.|
|tests||The test directory contains all your application test cases.|
|vendor||The vendor directory includes all composer dependencies files.|
The App Directory Structure in Laravel
The console directory holds all your project artisan commands, The other file is Kernel.php.
Exceptions directory contains all your web application exception handling files, which handles exceptions that occur in the laravel project.
It also contains a default file called handler.php to handle exceptions.
The Https Directory contains sub-folders for controllers, middleware & requests files.
– Controllers Folder
The Controllers folder contains files to handles all your web application requests.
– Middleware Folder
The Middleware folder contains middleware file to filter between request and response.
The provider’s folder holds files of service providers for core servers and configures the laravel application.
The Bootstrap Directory Structure in Laravel
Cache Directory contains files for caching a web application.
the other file called app.php holds scripts for bootstrap.
The Config Directory Structure in Laravel
It contains all configuration files for laravel web applications.
The Database Directory Structure in Laravel
This folder contains a file called UserFactory.php which is used to generate large numbers of users.
Migrations folder helps to migrate the database in the web application.
The Seeds contains classes for database unit testing in the laravel application.
The Public Directory Structure in Laravel
This file contains server configurations for your web application.
This file used to initialize your laravel application.
The Resources Directory Structure in Laravel
The lang folder contains files to configure localization and internationalization.
The views folder holds HTML & blade template files that interact with end-users. view is really important to serve User interface to users & it’s a part of MVC.
The Routes Directory Structure in Laravel
Web.php contains a definition of each route of the web application. it’s a file where all URLS are defines.
The Storage Directory Structure in Laravel
The app folder holds a file that are executed in succession.
This contains cache, sessions & views related folders.
The log contains a logs file for error & exceptions.
The Test Directory Structure in Laravel
As the name suggests it contains all unit test cases of laravel web application. test case name follows camel_case.
The Test Directory Structure in Laravel
As the name suggests, it contains all unit test cases to test your laravel web application. the test cases name follow camel_case naming convention.
The Vendor Directory Structure in Laravel
The vendor directory contains all composer dependencies which are used to install any third-party libraries, utilities, etc.
Others File in Laravel Directory Structure
These files also play an important role in many functionalities such as environment setting, GitHub configuration, Packages & third-part libraries for smoothly running laravel web application.