Laravel Application Structure
The application structure is the structure of folders, sub-folders, and files available in the project. Once the project is created in Laravel, the application structure generated as shown in the below screenshot:
Laravel's app directory
The app folder is one of the major folders in Laravel as most of the code is written in the app folder. The App folder contains the following sub-folders:
Console folder contains the artisan commands required for Laravel. It contains the commands which are declared with the appropriate signature.
Exceptions folder contains the various exception handlers. It handles the exceptions thrown by the Laravel project. The Exceptions directory contains the methods that handle the exceptions.
The Exceptions directory contains the file handle.php that handles all the exceptions.
The http folder is a sub-folder of the app folder. It has sub-folders such as controllers, middleware, and requests. Laravel follows the MVC architecture, so http includes controllers, views, and requests.
The Providers directory is used to contain all the service providers that are required to register events for core servers and provides configuration for Laravel application.
Laravel's bootstrap directory
The bootstrap directory holds the files that are required to bootstrap the Laravel application and to configure auto-loading. The bootstrap folder contains a sub-folder cache used for caching a web application. It also contains the file app.php that initializes the scripts required for bootstrap.
The above screen shows the structure of the bootstrap directory. It contains one folder, i.e., cache and two files, app.php and autoload.php.
Laravel's config directory
The config's directory contains the various configuration files required for the Laravel application. Various files are available inside the config's directory shown in the below screenshot, and each file performs their functionalities as per their names.
Laravel's Database directory
The database directory holds the database files. It contains sub-folders factories, migrations, and seeds. The structure of the database directory is shown below:
The database directory consists of three sub-folders:
Laravel's Public directory
The public directory is a root folder that contains the front controllers used for initializing the Laravel web application. Following are the sub-folders of a public directory:
The structure of the public directory is shown in the below screenshot:
Laravel's Resource directory
The resource directory holds the files used to enhance the web application. It contains the following sub-folders:
The structure of the Resource directory is shown below:
Laravel's Storage Directory
The storage directory contains those files which are required frequently when a Laravel project is running. It contains the following folders:
The structure of the storage directory is shown in the below screenshot:
Laravel's Test directory
The test directory holds all the automated unit test cases. The naming convention of test classes is camel_case but follow the naming convention according to the functionality of a class.
Laravel's Vendor directory
The vendor directory contains the composer dependencies, for example, to install Laravel setup, the composer is required. The vendor folder contains all the composer dependencies.