Laravel Folder Structure

When you create a new Laravel project (laravel new my-app), you will see a structure like this:

my-app/
│
├── app/
│  ├── Console/
│  ├── Exceptions/
│  ├── Http/
│  │  ├── Controllers/
│  │  ├── Middleware/
│  ├── Models/
│  └── Providers/
│
├── bootstrap/
├── config/
├── database/
├── public/
├── resources/
│  ├── views/
│  ├── js/
│  ├── css/
│
├── routes/
│  ├── web.php
│  ├── api.php
│  ├── console.php
│
├── storage/
├── tests/
└── vendor/



1. app/:

  • Contains the core business logic.
  • Controllers → Handle HTTP requests.
  • Models → Represent database tables.
  • Middleware → Filters requests before they reach controllers.

2. routes/:

  • Defines all the application routes.
  • web.php → Browser routes (HTML pages).
  • api.php → API routes (JSON responses).

3. resources/:

  • Contains views (Blade templates), CSS, and JavaScript.



4. public/:

  • Entry point of the application.
  • Contains index.php, which bootstraps Laravel.
  • All assets (CSS, JS, images) are served from here.



5. config/:

  • Stores configuration files (database, cache, session, mail, etc.).



6. database/:

  • Stores migrations, factories, and seeders for database handling.



7. storage/:

  • Stores cache, logs, and file uploads.

8. vendor/:

  • Contains all composer dependencies.
  • Never modify this folder directly.

Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.