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

    Learn programming in R: courses

    $

    Best Python online courses for 2022

    $

    Best laptop for Fortnite

    $

    Best laptop for Excel

    $

    Best laptop for Solidworks

    $

    Best laptop for Roblox

    $

    Best computer for crypto mining

    $

    Best laptop for Sims 4

    $

    Latest questions

    NUMPYNUMPY

    Common xlabel/ylabel for matplotlib subplots

    12 answers

    NUMPYNUMPY

    How to specify multiple return types using type-hints

    12 answers

    NUMPYNUMPY

    Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

    12 answers

    NUMPYNUMPY

    Flake8: Ignore specific warning for entire file

    12 answers

    NUMPYNUMPY

    glob exclude pattern

    12 answers

    NUMPYNUMPY

    How to avoid HTTP error 429 (Too Many Requests) python

    12 answers

    NUMPYNUMPY

    Python CSV error: line contains NULL byte

    12 answers

    NUMPYNUMPY

    csv.Error: iterator should return strings, not bytes

    12 answers


    Wiki

    Python | How to copy data from one Excel sheet to another

    Common xlabel/ylabel for matplotlib subplots

    Check if one list is a subset of another in Python

    sin

    How to specify multiple return types using type-hints

    exp

    Printing words vertically in Python

    exp

    Python Extract words from a given string

    Cyclic redundancy check in Python

    Finding mean, median, mode in Python without libraries

    cos

    Python add suffix / add prefix to strings in a list

    Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

    Python - Move item to the end of the list

    Python - Print list vertically