Getting Started with Laravel 12
Getting Started with Laravel 12
Laravel 12 brings many exciting new features. Let's explore the streamlined application structure.
New Application Structure
The app/Http/Kernel.php file is gone! Middleware is now configured in bootstrap/app.php:
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__.'/../routes/web.php',
)
->withMiddleware(function (Middleware $middleware): void {
$middleware->web(append: [
SetLocale::class,
]);
})
->create();
Running Your First Command
composer create-project laravel/laravel my-app
cd my-app
php artisan serve
Key Improvements
- Streamlined structure - fewer boilerplate files
- Better middleware - configure in
bootstrap/app.php - Modern PHP - requires PHP 8.2+
- Improved DX - better error messages and debugging
Laravel 12 is the best version yet for building modern web applications.
Happy coding!