Laravel Directory Structure

  • app − This directory contains the core code of the application.
  • bootstrap − This directory contains the application bootstrapping script.
  • config − This directory contains configuration files of application.
  • database − This folder contains your database migration and seeds.
  • public − This is the application’s document root. It starts the Laravel application. It also contains the assets of the application like JavaScript, CSS, Images, etc.
  • resources − This directory contains raw assets such as the LESS & Sass files, localization and language files, and Templates that are rendered as HTML.
  • storage − This directory contains App storage, like file uploads etc. Framework storage (cache), and application-generated logs.
  • test − This directory contains various test cases.
  • vendor − This directory contains composer dependencies.

  • App Directory

    This is the application directory. It contains a variety of additional directories, which are described below −

  • Console − All the artisan commands are stored in this directory.
  • Events − This directory stores events that your application can raise. Events may be used to alert other parts of your application that a given action has occurred, providing a great deal of flexibility and decoupling.
  • Exceptions − This directory contains your application's exception handler and is also a good place to stick any exceptions thrown by your application.
  • Http − This directory contains your controllers, filters, and requests.
  • Jobs − This directory contains the queueable jobs for your application.
  • Listeners − This directory contains the handler classes for your events. Handlers receive an event and perform logic in response to the event being fired. For example, a UserRegistered event might be handled by a SendWelcomeEmail listener.
  • Policies − This directory contains various policies of the application
  • Providers − This directory contains various service providers.
  • App :-

    It is the application folder and includes the entire source code of the project. your application lives in the app directory. By default, this directory is namespaced under App and is autoloaded by Composer

    The app directory contains a variety of additional directories such as Console, Http, Exceptions, and Providers.


    Console :-

    Console includes the artisan commands necessary for Laravel. It includes a directory named Commands, where all the commands are declared with the appropriate signature. The file Kernal.php calls the commands declared in Inspire.php.


    Exceptions

    This folder contains all the methods needed to handle exceptions. It also contains the file handle.php that handles all the exceptions.

    Http

    Http directory contains your controllers, middleware, and requests.

    The Http folder has sub-folders for controllers, middleware and application requests. As Laravel follows the MVC design pattern, this folder includes model, controllers and views defined for the specific directories.

    The Middleware sub-folder includes middleware mechanism, comprising the filter mechanism and communication between response and request. The Requests sub-folder includes all the requests of the application.


    Config :-

    The config folder includes various configurations and associated parameters required for the smooth functioning of a Laravel application.

    contains all of your application's configuration files.


    Database :-

    As the name suggests, this directory includes various parameters for database functionalities. It includes three sub-directories as given below −

  • Seeds − This contains the classes used for 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 large number of data records.

  • Public :-

    It is the root folder which helps in initializing the Laravel application. It includes the following files and folders.

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

  • Resources

    Resources directory contains the files which enhances your web application.

  • assets − The assets folder include files such as LESS and SCSS, that are required for styling the web application.
  • lang − This folder includes configuration for localization or internalization.
  • views − Views are the HTML files or templates which interact with end users and play a primary role in MVC architecture.

  • Laravel Framework Files

    .env: It includes environment variables for application and is pretty much crucial for the working environment of laravel directory structure as well as framework files.



    .env.example: It also includes environment variables for .application.



    .gitattributes: It incorporates as a Git configuration files.



    .gitignore: It is also a Git configuration file.



    Artisan: It provides you with the working environment that helps empowers you to run Artisan commands.



    composer.json: it is a configure file for the composer.



    composer.lock: it is also a configure file for the composer.



    gulpfile.js: it is the configuration file for Gulp as well as Exilir.



    package.json: It is for the frontend, but mostly it is like composer.json.



    phpunit.xml: it is a configuration file for PHPUnit



    readme.md: It includes general information about the framework.



    server.php. It works as an internal web server and has a primary role in framework working environment.





    Previous Next


    Trending Tutorials




    Review & Rating

    0.0 / 5

    0 Review

    5
    (0)

    4
    (0)

    3
    (0)

    2
    (0)

    1
    (0)

    Write Review Here


    Ittutorial