X
    Categories: Laravel

Structure of Laravel Application

Laravel application has a very clean and managed directory structure. It is not compulsory to follow the structure of laravel. You can manage your application code as per your convenience.

The following image shows the directory structure of the laravel application.

App

The app folder contains all the logic for your application.

Bootstrap

The bootstrap folder contains a cache folder and a file app.php. This file app.php is responsible to integrate all the components and interfaces required laravel framework to run i.e. it initializes the whole application.

Config

The config folder contains all the configuration files of the application.

Database

The database directory contains all the functionality related to the database of your application.

This folder contains three subfolders. Seeds, Migrations, Factories.

The laravel provides the seeding method to create test data for your application. The seeds folder stores all the seed.

Migration: Laravel made the easy way to create and alter your application’s database schema by using migrations.

Factories as the name self describe a factory as a method to produce a large amount of data to test the application.

Public

It is the entry point of your application. All the request from the outside world is handled here.

Resources

This folder contains all the views and related assets such as raw javaScript, Cascade Style Sheets for your application.

Route

This directory contains all the route definition of your application i.e. for some action where to go or what action is to perform.

Storage

This folder contains the cache of application and the error logs generated while running your application.

Test

As laravel provides a PHPUnit test module by default. This folder contains all of your test case classes.

Vendor

This folder contains all the dependencies that are required to run the laravel framework and the dependencies you download using the composer while developing your application.

Besides these folders, the laravel root directory also contains some files.

.env & .env.example

It is an environment variable file for your application. This is a crucial file to run the application as per your development environment.

It contains the different environment setting variables for example database, application name, application key, Mail server, etc.

.gitattributes

This file contains the git hub configuration.

Artisan

As laravel provides its own command-line interface artisan. This file is for running the artisan commands.

composer.json

This is the configuration file for the composer. All the required dependencies to run the application are mentioned here.

package.json

This file contains the dependencies for the frontend of the laravel application.

phpunit.xml

This is the configuration for the PHPUnit testing facility provided by laravel by default.server.php laravel provides its own development server. This file works as a web server and allows preview of the laravel application.

greattechblog: