Laravel 12: New Features and Upgrade Notes | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. Laravel 12: Structured Route Files, Slim Skeletons, and the New Application Bootstrapping

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

 Laravel 12 ships with a leaner skeleton, first-class route file organisation, and a revised application bootstrapping contract. Here is what changed, why it matters, and how to upgrade cleanly.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 1 Jul 2026 · Updated 1 Jul 2026 · 3 min read

ShareCopy linkCopied

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

  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)

 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.

- [laravel](https://www.msaied.com/public/articles?search=laravel)
- [laravel-12](https://www.msaied.com/public/articles?search=laravel-12)
- [upgrade](https://www.msaied.com/public/articles?search=upgrade)
- [routing](https://www.msaied.com/public/articles?search=routing)
- [php](https://www.msaied.com/public/articles?search=php)

 Frequently asked questions 
---------------------------

  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.

   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.

   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.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

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

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleLaravel API Resources: Sparse Fieldsets, Conditional Relationships, and Versioning](https://www.msaied.com/public/articles/laravel-api-resources-sparse-fieldsets-conditional-relationships-and-versioning) [Next articleLaravel 13: New Features, Helpers, and Practical Upgrade Notes](https://www.msaied.com/public/articles/laravel-13-new-features-helpers-and-practical-upgrade-notes)  

   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)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
