Laravel 12: New Features and Upgrade Notes | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping        On this page       1. [  What Actually Changed in Laravel 12 ](#what-actually-changed-in-laravel-12)
2. [  The Slim Skeleton ](#the-slim-skeleton)
3. [  Structured Route Files by Convention ](#structured-route-files-by-convention)
4. [  Removed Deprecated Helpers ](#removed-deprecated-helpers)
5. [  Upgrading from Laravel 11 ](#upgrading-from-laravel-11)
6. [  1. Update composer.json ](#1-update-codecomposerjsoncode)
7. [  2. Publish the new stubs ](#2-publish-the-new-stubs)
8. [  3. Audit deprecated usages ](#3-audit-deprecated-usages)
9. [  4. Check package compatibility ](#4-check-package-compatibility)
10. [  PHP Version Requirements ](#php-version-requirements)
11. [  Key Takeaways ](#key-takeaways)

  ![Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping](https://cdn.msaied.com/337/05b39d16d0f88a5fb94d0cf74049b88b.png)

  #laravel   #laravel-12   #upgrade   #routing   #php  

 Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping 
===========================================================================================

     1 Jul 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

  11 sections  

1. [  01   What Actually Changed in Laravel 12  ](#what-actually-changed-in-laravel-12)
2. [  02   The Slim Skeleton  ](#the-slim-skeleton)
3. [  03   Structured Route Files by Convention  ](#structured-route-files-by-convention)
4. [  04   Removed Deprecated Helpers  ](#removed-deprecated-helpers)
5. [  05   Upgrading from Laravel 11  ](#upgrading-from-laravel-11)
6. [  06   1. Update composer.json  ](#1-update-codecomposerjsoncode)
7. [  07   2. Publish the new stubs  ](#2-publish-the-new-stubs)
8. [  08   3. Audit deprecated usages  ](#3-audit-deprecated-usages)
9. [  09   4. Check package compatibility  ](#4-check-package-compatibility)
10. [  10   PHP Version Requirements  ](#php-version-requirements)
11. [  11   Key Takeaways  ](#key-takeaways)

       What Actually Changed in Laravel 12
-----------------------------------

Laravel 12 is not a paradigm shift — it is a focused refinement. The headline changes are a slimmer default skeleton, a cleaner route file layout, a revised `bootstrap/app.php` contract, and the removal of several long-deprecated helpers. If you have kept up with 10 and 11, the upgrade is straightforward. If you skipped 11, read on carefully.

---

The Slim Skeleton
-----------------

Laravel 11 introduced the condensed skeleton that dropped `app/Http/Kernel.php` and `app/Providers/RouteServiceProvider.php`. Laravel 12 doubles down: a fresh `laravel new` project ships with fewer stub files and a single `bootstrap/app.php` that owns middleware registration, exception handling, and routing in one place.

```php
// bootstrap/app.php — Laravel 12 default
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: [
            \App\Http\Middleware\HandleInertiaRequests::class,
        ]);
    })
    ->withExceptions(function (Exceptions $exceptions) {
        $exceptions->render(function (\App\Exceptions\DomainException $e, Request $request) {
            return response()->json(['error' => $e->getMessage()], 422);
        });
    })
    ->create();

```

The `withRouting` call now accepts a `then` closure for anything dynamic — useful for module-based route loading without a custom service provider.

```php
->withRouting(
    web: __DIR__.'/../routes/web.php',
    then: function () {
        Route::middleware('api')
            ->prefix('webhooks')
            ->group(base_path('routes/webhooks.php'));
    },
)

```

---

Structured Route Files by Convention
------------------------------------

The `routes/` directory now ships with `web.php`, `api.php`, `console.php`, and `channels.php`. Each is auto-loaded based on the `withRouting` declaration — no manual `require` or service provider needed. This is not new functionality, but the skeleton now enforces the pattern from day one.

For modular monoliths, the `then` closure is the idiomatic hook:

```php
then: function () {
    foreach (glob(base_path('modules/*/routes.php')) as $file) {
        Route::middleware('web')->group($file);
    }
},

```

---

Removed Deprecated Helpers
--------------------------

Several helpers deprecated in Laravel 9–11 are gone:

- `Str::replaceArray()` — use `str_replace` with an array.
- `Route::prefix()` chained directly on the facade without a group closure.
- The `dispatchNow` alias on the `Bus` facade — use `dispatchSync`.

Run `php artisan about` and review your `composer.json` for packages that may still call these internally.

---

Upgrading from Laravel 11
-------------------------

### 1. Update `composer.json`

```json
"laravel/framework": "^12.0"

```

Run `composer update` and address any immediate conflicts before touching application code.

### 2. Publish the new stubs

```bash
php artisan stub:publish

```

Compare your existing `bootstrap/app.php` against the new default. If you are on Laravel 11 already, the diff is minimal.

### 3. Audit deprecated usages

```bash
grep -rn 'dispatchNow\|replaceArray' app/ routes/

```

Replace each hit before deploying.

### 4. Check package compatibility

Filament v3/v4, Spatie packages, and most first-party packages had 12-compatible releases within days of the framework tag. Pin to their latest minor before upgrading the framework in production.

---

PHP Version Requirements
------------------------

Laravel 12 requires **PHP 8.2** at minimum, with full support for 8.3 and 8.4. If you are still on 8.1, upgrade PHP first — the framework will refuse to install.

---

Key Takeaways
-------------

- `bootstrap/app.php` is now the single source of truth for middleware, routing, and exception rendering.
- The `withRouting(then:)` closure is the clean hook for module-based or conditional route loading.
- Several long-deprecated helpers are removed — audit with `grep` before upgrading.
- PHP 8.2+ is required; test on 8.3 to benefit from typed class constants and improved readonly semantics.
- The upgrade from Laravel 11 is low-risk; from Laravel 10 it requires the 11 skeleton migration first.

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-12-structured-route-files-slim-skeletons-and-the-new-application-bootstrapping&text=Laravel+12%3A+Structured+Route+Files%2C+Slim+Skeletons%2C+and+the+New+Application+Bootstrapping) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravel-12-structured-route-files-slim-skeletons-and-the-new-application-bootstrapping) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Can I upgrade directly from Laravel 10 to Laravel 12?        Not in a single step. Laravel 10 uses the old Kernel and RouteServiceProvider structure. You should migrate to the Laravel 11 skeleton first — adopting bootstrap/app.php — then bump to 12. Attempting to skip 11 means doing both migrations at once, which increases risk. 

      Q02  Does Laravel 12 change how Filament panels are bootstrapped?        No. Filament registers its panels via a service provider that is still resolved through the standard container. The bootstrap/app.php changes only affect how the framework's own middleware and routing are declared, not third-party service providers. 

      Q03  Is the withRouting 'then' closure the right place for module route loading?        Yes. The 'then' closure runs after the named route files are loaded, giving you full access to the Route facade. It is the idiomatic replacement for a custom RouteServiceProvider in modular monolith setups. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Laravel 13: New Features, Helpers, and Practical Upgrade Notes](https://cdn.msaied.com/339/58c4fa6fe9b6d25a2dac17c621b6f4c6.png) laravel laravel-13 upgrade 

### Laravel 13: New Features, Helpers, and Practical Upgrade Notes

Laravel 13 ships with async-first defaults, a leaner bootstrapping layer, and several quality-of-life helpers....

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-13-new-features-helpers-and-practical-upgrade-notes) [ ![Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning](https://cdn.msaied.com/336/89d518450335e8fcdaa5be882cf4dd3e.png) laravel api resources 

### Laravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning

Go beyond basic API resources. Learn how to implement sparse fieldsets, conditionally load relationships, and...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-versioning) [ ![Laravel WebSocket Broadcasting with Reverb: Scaling Beyond a Single Worker](https://cdn.msaied.com/335/b2461babce9e90ae5fe8dc789cd7046c.png) laravel reverb websockets 

### Laravel WebSocket Broadcasting with Reverb: Scaling Beyond a Single Worker

Reverb ships with a single-process model by default. Learn how to scale it horizontally with Redis pub/sub, tu...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 1 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-websocket-broadcasting-with-reverb-scaling-beyond-a-single-worker) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
