Laravel 10 Directory Structure in 2 minutes

Ashutosh Kukreti

A typical Laravel project structure will look like

app/
    Http/
        Controllers/
        Middleware/
        Requests/
    Providers/
bootstrap/
config/
database/
    factories/
    migrations/
    seeds/
public/
resources/
    assets/
        js/
        sass/
    lang/
    views/
routes/
storage/
    app/
    framework/
    logs/
tests/
vendor/
.env
artisan
composer.json
composer.lock
package.json
README.md

Laravel follows a specific directory structure that helps to organize the different parts of the application. Here's a brief overview of the different directories and their purposes:

app/: Contains the core code of your application, including controllers, middleware, requests, and providers.

  • Http/: Contains the controllers, middleware, and requests for handling HTTP requests.
  • Controllers/: Contains the controllers that handle the HTTP requests.
  • Middleware/: Contains the middleware that can be used to filter HTTP requests.
  • Requests/: Contains the form request classes used to validate HTTP requests.
  • Providers/: Contains the service providers that register services with the Laravel application.
  • bootstrap/: Contains the files needed to bootstrap the Laravel application.
  • config/: Contains configuration files for the Laravel application.

database/: Contains database-related files, including migrations, factories, and seeds.

  • migrations/: Contains database migration files used to create or modify database tables.
  • seeds/: Contains database seed files used to populate the database with test data.
  • public/: Contains the public files, including the index.php file, which is the entry point for all HTTP requests.

resources/: Contains resources that are used in the application, including assets, language files, and views.

  • assets/: Contains CSS, JavaScript, and other assets.
  • lang/: Contains language files used in the application.
  • views/: Contains the view files used to render the HTML.
  • routes/: Contains the route definitions for the Laravel application.

storage/: Contains the storage files used by the application, including the logs and application-specific files.

  • app/: Contains files that are specific to the application.
  • framework/: Contains files that are used by the Laravel framework.
  • logs/: Contains the log files generated by the application.
  • tests/: Contains the test files for the Laravel application.
  • vendor/: Contains the files installed by Composer, including the Laravel framework and third-party packages.
  • .env: Contains environment-specific settings for the Laravel application.
  • artisan: The Laravel command-line interface (CLI) tool.
  • composer.json: The configuration file for the Composer package manager.
  • composer.lock: A file generated by Composer that contains information about the installed packages.
  • package.json: The configuration file for the Node.js package manager.
  • README.md: The README file for the Laravel application.
Laravel