laravel-11-noteslisted
Install: claude install-skill hmj1026/dhpk
# Laravel 11 — streamlined structure, casts() method, /up
Released March 2024. PHP 8.2+ floor. **The biggest structural rework
since 5.0** — upgraders should expect a real migration project, not a
drop-in.
---
## Signature features
### Streamlined app structure
Laravel 11 collapses three previously-separate configuration files into
one:
| Before (L ≤10) | After (L 11) |
|---|---|
| `app/Http/Kernel.php` (middleware) | `bootstrap/app.php` (middleware section) |
| `app/Console/Kernel.php` (scheduled tasks) | `bootstrap/app.php` (commands section) |
| `app/Exceptions/Handler.php` (exception handling) | `bootstrap/app.php` (exceptions section) |
```php
// bootstrap/app.php
return Application::configure(basePath: dirname(__DIR__))
->withRouting(
web: __DIR__ . '/../routes/web.php',
api: __DIR__ . '/../routes/api.php',
commands: __DIR__ . '/../routes/console.php',
health: '/up',
)
->withMiddleware(function (Middleware $middleware) {
$middleware->web(append: [EnsureUserIsSubscribed::class]);
})
->withExceptions(function (Exceptions $exceptions) {
$exceptions->render(function (NotFoundHttpException $e, Request $request) {
return response()->json(['error' => 'not found'], 404);
});
})->create();
```
**Upgrade trap**: Laravel 10 → 11 upgraders can **keep** the old
three-file layout. Laravel ships Backport classes that let
`app/Http/Kernel.php` work in 11. Don't feel pressured