Skip to main content

Documentation Index

Fetch the complete documentation index at: https://kawax.biz/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Laravel’s default application structure is a sensible starting point for both small and large applications. You’re free to organise your application however you like — Laravel imposes almost no restrictions on where any given class is located, as long as Composer can autoload it.

Root directory

When you create a new Laravel project, the following structure is generated:
example-app/
├── app/
├── bootstrap/
├── config/
├── database/
├── public/
├── resources/
├── routes/
├── storage/
├── tests/
├── vendor/
├── .env
├── artisan
└── composer.json

app/ directory

Contains the core code of your application. Almost all of your application’s classes live here, including controllers, models, and middleware. By default it includes Http/, Models/, and Providers/ subdirectories. Additional subdirectories are created automatically when you generate classes with Artisan commands.

bootstrap/ directory

Contains the app.php file that bootstraps the framework, along with a cache/ directory that holds framework-generated files for performance optimisation (route and service caches).

config/ directory

Contains all of your application’s configuration files. It’s worth reading through these files to familiarise yourself with the available options.

database/ directory

Contains database migrations, model factories, and seeders. SQLite database files can also be stored here.

public/ directory

Contains the index.php file, which is the entry point for all requests entering your application. It also houses your assets — images, JavaScript, and CSS.
Set your web server’s document root to Laravel’s public/ directory. Pointing it at the project root or a subdirectory risks exposing sensitive files.

resources/ directory

Contains your views and raw, uncompiled assets such as CSS and JavaScript.

routes/ directory

Contains all route definitions for your application. Two route files are included by default: web.php and console.php.
FilePurpose
web.phpRoutes for browser-facing pages. The web middleware group applies session handling, CSRF protection, and cookie encryption.
console.phpDefine closure-based Artisan commands.
api.phpStateless API routes. Add with php artisan install:api.
channels.phpRegister event broadcast channels.

storage/ directory

Contains logs, compiled Blade templates, file-based sessions, file caches, and other files generated by the framework. It is split into app/, framework/, and logs/ subdirectories.

tests/ directory

Contains your automated tests. Starter examples for both Pest and PHPUnit are included out of the box.

vendor/ directory

Contains your Composer dependencies. Do not commit this directory to source control.

Inside app/

Most classes in the app directory can be generated with Artisan commands. To see what’s available, run:
php artisan list make
Contains controllers, middleware, and form requests. Nearly all of the logic for handling requests entering your application lives here.
Contains all Eloquent model classes. Each database table has a corresponding model used to query and insert data.
Contains all service providers for your application. Service providers bootstrap the application by binding services into the container, registering events, and more.
Contains all custom Artisan commands. Generate new ones with php artisan make:command.
Contains your application’s custom exception classes. Generate them with php artisan make:exception.

Key files

.env file

Manages environment-specific configuration values such as database credentials and API keys. Values here are referenced from config/ files via the env() helper.
APP_NAME=Laravel
APP_ENV=local
APP_DEBUG=true
APP_URL=http://localhost

DB_CONNECTION=sqlite

artisan file

The entry point for the Artisan command-line interface. Run commands with:
php artisan <command>

Next steps

Routing

Learn how to define routes and connect URLs to your application logic.
Last modified on March 29, 2026