Laravel 12: What's New in the Latest Release

Laravel 12: What's New in the Latest Release

Laravel 12 continues the framework's tradition of developer happiness with thoughtful improvements across the board.

Streamlined Directory Structure

Laravel 12 introduces a cleaner default application structure. The app/Http directory is now flatter, with controllers directly in app/Http/Controllers without the default nested structure.

Enhanced Model Casts

Casting has been improved with more intuitive syntax:

protected function casts(): array
{
    return [
        'options' => AsCollection::using(OptionCollection::class),
        'metadata' => AsArrayObject::class,
    ];
}

Improved Artisan Commands

New Artisan commands make common tasks easier:

  • php artisan make:enum - Generate enum classes
  • php artisan make:trait - Generate traits
  • php artisan db:show - Display database information

Better Testing Tools

Laravel 12 enhances the testing experience with improved assertion methods and better error messages when tests fail.

Performance Improvements

Under the hood, Laravel 12 includes numerous performance optimizations, particularly in route matching and Eloquent query building.

Upgrading from Laravel 11

The upgrade path is smooth for most applications. Run composer update and review the upgrade guide for any breaking changes specific to your codebase.

Laravel remains the most popular PHP framework for good reason—it keeps getting better with each release.

Ready to Start Your Project?

Let's discuss how we can help bring your ideas to life.

Get Free Quote