dataDesk BLOG

Welcome to the blog of Mr.G

Nature
Posts: 2

Blog 1: Laravel_structure.md | (Open) | (Share)

▲ Previous | Next ▼

/Dev/HowTo

Last modified: May 29 2025 19:06:58

Laravel structure

Laravel's basic structure follows a clean MVC (Model-View-Controller) pattern, organized in a way that separates logic, presentation, and data. Here's an overview of the default Laravel project structure:

your-project/
├── app/                   # Application core code
│   ├── Console/           # Artisan commands
│   ├── Exceptions/        # Error handling
│   ├── Http/              # Controllers, middleware, requests
│   │   ├── Controllers/   # Route handlers (MVC Controllers)
│   │   ├── Middleware/    # HTTP middleware
│   │   └── Requests/      # Form request validation
│   ├── Models/            # Eloquent models (data layer)
│   └── Providers/         # Service providers (bootstrapping)
│
├── bootstrap/             # Framework bootstrap/start files
│   └── app.php            # Entry point for bootstrapping the app
│
├── config/                # Configuration files (app, database, etc.)
├── database/              # Migrations, factories, seeders
│   ├── factories/
│   ├── migrations/
│   └── seeders/
│
├── public/                # Publicly accessible files (index.php, assets)
│   └── index.php          # Front controller (entry point for web requests)
│
├── resources/             # Views, raw assets (Sass, JS), translations
│   ├── views/             # Blade templates (HTML views)
│   └── lang/              # Language files
│
├── routes/                # Route definitions
│   ├── web.php            # Routes for the web (uses session & CSRF)
│   ├── api.php            # Routes for API (stateless)
│   └── console.php        # Artisan commands
│
├── storage/               # Logs, compiled views, cache, user uploads
├── tests/                 # Unit and feature tests
├── vendor/                # Composer dependencies
├── artisan                # CLI for Laravel (Artisan tool)
├── .env                   # Environment configuration
├── composer.json          # PHP dependencies
└── package.json           # JS dependencies (optional frontend build tools)

Key Concepts:

  • MVC: Models (app/Models), Views (resources/views), Controllers (app/Http/Controllers)
  • Routes: Defined in routes/web.php or routes/api.php
  • Artisan: Laravel’s CLI, invoked with php artisan
  • Eloquent: Laravel’s ORM, models go in app/Models
  • Blade: Laravel’s templating engine, lives in resources/views

Minimal Flow Example:

  1. User visits /users → Route defined in routes/web.php
  2. Route points to UserController@index
  3. UserController queries data using a User model
  4. Controller returns a Blade view with data
  5. View is rendered and served via public/index.php

In a Laravel project, the framework is structured in a way that separates core framework code from your application code, so when you update Laravel (e.g., via Composer), only the framework is updated — your application code remains untouched as long as you haven't edited the framework files directly.


✅ Parts That Are Updated During a Laravel Framework Update

When you run:

composer update

Laravel updates packages defined in composer.json, especially:

🛠 Framework Core (stored in vendor/laravel/)

  • vendor/laravel/framework/: Laravel's internal code (routing, requests, responses, validation, etc.)
  • vendor/*: Other dependencies like Symfony components, Guzzle, etc.
  • bootstrap/cache/*: May be regenerated (e.g., config.php, routes.php)

🧱 Your Application Code (Untouched by Laravel Updates)

Laravel does NOT touch your code in:



Blog 2: 17479137377347655841824283231797.png | (Open) | (Share)

▲ Previous

/WebDAV/SyncPhone

(Last modified: May 22 2025 13:35:38)
17479137377347655841824283231797
Image
Shared by © dataDesk


Who I am

"Just me, myself, and I, exploring the universe of unknownment, embracing the mystery of what lies beyond, one star at a time."

Share this page on Facebook | X.com | Reddit

Page Content

  • Image Laravel structure
    Published: 2025-05-29
    Read
  • Image 17479137377347655841824283231797
    Published: 2025-05-22
    Read

Tags

WebDev New York London AI NORWAY DIY Ideas Life Family News Clothing Invest Sports Health