Skip to the workspace
Pebellslearn by building
Request–Response Flow and Project Folders  ›  Lesson

app, bootstrap and config

App 12 minapp/ holds your own PHP classes, bootstrap/ builds the application, and config/ holds settings files that read their values from .env.

laravel / app, bootstrap and config

Explore each scene at your own pace.

01 · The rule

The rule

app, bootstrap and config

Open a fresh Laravel project and you see about a dozen folders. Three of them decide how the app is built and how it behaves: app/ for your classes, bootstrap/ for starting the app, and config/ for settings. Put things in the right one and Laravel finds them without being told.

The rule

app/ is your code, bootstrap/ starts it, config/ tunes it.

app/: your own PHP classes. Everything here uses the App\ namespace, so app/Models/Book.php is App\Models\Book.

  • app/Models/: Eloquent models, such as User and Book
  • app/Http/Controllers/: controllers
  • app/Providers/: service providers, such as AppServiceProvider

More folders, such as app/Jobs or app/Policies, appear when you generate those classes with Artisan.

bootstrap/: building the app.

  • bootstrap/app.php: routing, middleware and exception setup
  • bootstrap/providers.php: the list of service providers to load
  • bootstrap/cache/: files Laravel generates to start faster. Never edit them.

config/: settings, one file per area, such as app.php, database.php, mail.php and session.php. Each file returns an array, and values that change per machine are pulled from .env:

// config/lendly.php
return [
    'loan_days' => env('LOAN_DAYS', 14),
];

Code reads settings with dot notation, file name first:

$days = config('lendly.loan_days'); // 14 unless .env says otherwise

Some config files are hidden in a new app to keep it small. php artisan config:publish copies them in when you need to change one.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.