For any queries you can reach us at infovistarindia@gmail.com / WhatsApp us: +919158876092

Laravel Application Structure - Infovistar

Application Structure

The application structure in Laravel is the structure of directories, sub-directories, and files included in a project. Once we create a project in Laravel, we get an overview of the application structure as shown in the image here.

Laravel application structure

The analysis of directories and files, along with their functions are as follows −

app

The app directory contains the base code for your Laravel application. It contains events, exceptions, and middleware declarations. It holds other sub-directories for additional purposes.

  • Console - The Console directory contains all your project artisan commands.
  • Exceptions - The Exceptions directory holds your laravel project's exception handling files, which handle all the exceptions thrown by your Laravel project.
  • Http - The Http directory holds different filters, requests, and controllers.
  • Providers - This directory includes all the service providers required to register events for core servers and configure a Laravel application.

bootstrap

This directory encloses all the application bootstrap scripts. It contains a sub-directory namely cache, which includes all the files associated with caching a web application. You can also find the file app.php, which initializes the scripts necessary for bootstrap.

config

The config directory holds all your project configuration files (.config).

database

The database directory holds your database files.

It includes three sub-directories as given below −

  • seeds − This contains the classes used for the unit testing database.
  • migrations− This folder helps in queries for migrating the database used in the web application.
  • factories − This folder is used to generate a large number of data records.

public

It is the root directory that helps in initializing the Laravel application. It includes the following files and directories −

  • .htaccess − This file gives the server configuration.
  • JavaScript and CSS − These files are considered assets.
  • index.php − This file is required for the initialization of a web application.

resources

The resources directory contains all the Sass files, language (localization) files, and templates (if any).

routes

The routes directory contains all your definition files for routing, such as console.php, api.php, channels.php, etc.

storage

The storage directory contains your session files, cache, compiled templates as well as miscellaneous files generated by the framework.

test

The test directory contains all your test cases.

vendor

The vendor directory contains all composer dependency files.