Laravel
February 10, 2024
8 min read
3 views

Getting Started with Laravel 11: What's New and How to Upgrade

Laravel 11 ships a slimmed-down skeleton, a new application structure, first-class SQLite support, per-second rate limiting, and a health-check route out of the box. Here is every breaking change and a step-by-step upgrade path from Laravel 10.

Laravel 11Laravel Upgrade GuidePHP 8.3Laravel New Features 2024Laravel Application StructureLaravel ReverbLaravel SQLiteLaravel Rate Limiting
Getting Started with Laravel 11: What's New and How to Upgrade

Laravel 11 is the most opinionated framework release in years. The team stripped the default application skeleton down to its essentials, removed almost all boilerplate service providers, consolidated middleware registration, and added a default SQLite database so you can run php artisan serve and have a working app in under a minute.

1. Requirements

  • PHP 8.2 minimum (PHP 8.3 recommended — it ships with typed class constants and the new json_validate() function).
  • Composer 2.x
  • Laravel Installer 5.x — composer global require laravel/installer

2. The New Slim Application Skeleton

  • app/Http/Kernel.php is gone — middleware is now registered in bootstrap/app.php.
  • app/Providers/AuthServiceProvider.php, BroadcastServiceProvider.php, EventServiceProvider.php, and RouteServiceProvider.php are all removed.
  • app/Console/Kernel.php is gone — scheduled tasks are now registered directly in routes/console.php.
  • app/Exceptions/Handler.php is gone — exception handling is configured in bootstrap/app.php.
  • config/ files are trimmed — many config files no longer exist in a fresh install.
bash
laravel new my-app
cd my-app
php artisan serve

3. bootstrap/app.php — The New Configuration Hub

php
<?php
use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;

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->append(\App\Http\Middleware\EnsureTokenIsValid::class);
        $middleware->validateCsrfTokens(except: ['stripe/*', 'webhooks/*']);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        $exceptions->render(function (\App\Exceptions\PaymentException $e, Request $request) {
            return response()->json(['error' => $e->getMessage()], 402);
        });
    })
    ->create();

4. Scheduled Tasks in routes/console.php

php
<?php
use Illuminate\Support\Facades\Schedule;

Schedule::command('emails:send')->hourly();
Schedule::call(function () {
    \App\Models\Report::generate();
})->daily()->at('00:00');

5. SQLite as the Default Database

bash
# Run migrations immediately on a fresh project — no database setup needed
php artisan migrate

6. Per-Second Rate Limiting

php
RateLimiter::for('api', function (Request $request) {
    return [
        Limit::perSecond(10),
        Limit::perMinute(500)->by($request->user()?->id ?: $request->ip()),
    ];
});

7. Built-in Health Check Endpoint

Pass health: '/up' in withRouting() and Laravel automatically registers a GET /up route that returns a 200 response. Ready for AWS ALB, Kubernetes liveness probes, or UptimeRobot.

8. New Artisan Commands

bash
php artisan make:enum OrderStatus
php artisan make:interface PaymentGateway
php artisan make:trait HasUuid
php artisan make:class Services/PaymentService

9. Step-by-Step Upgrade from Laravel 10

  • Step 1 — Update composer.json: bump laravel/framework to ^11.0 and minimum PHP to ^8.2.
  • Step 2 — Run composer update to pull the new framework version.
  • Step 3 — Publish the new bootstrap/app.php and move your Kernel.php middleware registrations into withMiddleware().
  • Step 4 — Move your Console Kernel scheduled tasks to routes/console.php using Schedule::command().
  • Step 5 — Move custom exception handling to the withExceptions() block.
  • Step 6 — Delete the now-unused Kernel files and old service providers.
  • Step 7 — Run php artisan config:clear && cache:clear and test your routes, middleware, and scheduled commands.
bash
composer update laravel/framework --with-all-dependencies
php artisan config:clear && php artisan cache:clear
php artisan view:clear && php artisan route:clear
php artisan migrate --force
php artisan test

10. Laravel Reverb — First-Party WebSocket Server

bash
php artisan install:broadcasting
php artisan reverb:start

Laravel 11 is not a breaking rewrite — existing Laravel 10 applications continue to work. The new skeleton is for fresh projects. When upgrading, you adopt the new conventions gradually rather than all at once.

Need help upgrading an existing Laravel application to version 11, or building a new Laravel 11 project from scratch? BitPixel Coders delivers production-grade Laravel solutions — get in touch for a free consultation.

Get a Free Consultation