Change language

Laravel | Directory structure

|
When you create a new Laravel application, it will contain a large number of folders as shown in the picture below: Each of these folders performs a specific task for the overall functioning of the framework. The purpose of each of these folders is explained below, but before that, let’s look at each of them one at a time:Directive structure:
  • directory applications
  • bootstrap directory
  • configuration directory
  • database directory data
  • public directory
  • resource directory
  • routes directory
  • storage directory
  • test directory
  • vendor directory
The purpose of each of these directories:
  • Application directory:This directory is the heart of the framework and the backend developers are mostly working on this directory. It contains all the internal code of our web application such as controllers, broadcasts, providers, custom Artisan commands, middleware, etc. This directory also contains many subdirectories as shown in the picture below:
    Application directory: Directory Purpose Console This directory contains all Artisan commands which are created by us. These commands can be generated using the php artisan make: commandcommand. Exceptions This directory contains the application’s exception handling files. Here you can create your own specific exceptions to be thrown by our application. Http This directory contains our controllers, middleware, and form requests. Almost all of the backend to handle requests entering our application will be placed here. Providers This directory contains all of the service providers for the application. Service providers bootstrap our application by making services available to us by registering them. Broadcasting This directory is not there by default but can be created by using the php artisan make: channelcommand. It contains all of the broadcast channel classes for our application to broadcast your events. Events This directory is not there by default but can be created by using the php artisan make: eventcommand. This directory contains event classes which can be used to give signals to other parts of the application or vice-versa. Jobs This directory is not there by default but can be created by using the php artisan make: jobcommand. This directory contains lineup jobs for our application. Listeners This directory is not there by default but can be created by using the php artisan make: listenercommand. This directory contains the classes that handle our events. Mail This directory is not there by default but can be created by using the php artisan make: mailcommand. This directory contains all of our classes that represent emails sent by application. Notifications This directory is not there by default but can be created by using the php artisan make: notificationcommand. This directory contains all of the “transactional” notifications that are sent by our application. Policies This directory is not there by default but can be created by using the php artisan make: policycommand. This directory contains the authorization policy classes which are used to determine if a user can access or change a specific data or not. Rules This directory is not there by default but can be created by using the php artisan make: rulecommand. This directory contains the self-created validation rule objects which are used to encapsulate complicated validation logic in a simple object.
  • Bootstrap directory: this directory contains the app.php file from which the entire framework is loaded. This directory also contains a cache directory that is used to store framework-generated files to optimize performance.
  • Configuration directory:This directory contains all configuration files related to database, mail, session , services, etc.
  • Database directory:This directory contains database migrations, model factories, and seeds.
  • public directory:this directory contains the index.php file, which is the entry point and handles all requests received by the application and also configures autoloading. In addition, this directory also contains the resources used in the application, such as images, javaScript, and css.
  • Resource directory:This directory contains the frontend of the application. All the HTML that generates the application interface is presented here in the form of Blade templates, which is the template engine Laravel ships with.
  • Route Catalog:This folder contains all the application route definitions .
  • repository directory:this directory contains compiled Blade templates, file sessions, file caches, and other files generated by the framework.
  • tests directory:this directory contains all of our automated tests that are needed to ensure that the application works as expected or not.
  • vendor directory:this directory contains all dependencies downloaded via Composer required by our platform.
  • Shop

    Best laptop for Sims 4

    $

    Best laptop for Zoom

    $499

    Best laptop for Minecraft

    $590

    Best laptop for engineering student

    $

    Best laptop for development

    $

    Best laptop for Cricut Maker

    $

    Best laptop for hacking

    $890

    Best laptop for Machine Learning

    $950

    Latest questions

    NUMPYNUMPY

    psycopg2: insert multiple rows with one query

    12 answers

    NUMPYNUMPY

    How to convert Nonetype to int or string?

    12 answers

    NUMPYNUMPY

    How to specify multiple return types using type-hints

    12 answers

    NUMPYNUMPY

    Javascript Error: IPython is not defined in JupyterLab

    12 answers

    Wiki

    Python OpenCV | cv2.putText () method

    numpy.arctan2 () in Python

    Python | os.path.realpath () method

    Python OpenCV | cv2.circle () method

    Python OpenCV cv2.cvtColor () method

    Python - Move item to the end of the list

    time.perf_counter () function in Python

    Check if one list is a subset of another in Python

    Python os.path.join () method