Laravel 7.12 Released

Published on by

Laravel 7.12 Released image

The Laravel team released v7.12.0 with a new TrustHosts middleware, along with the latest updates to the 7.x branch.

TrustHosts Middleware

Taylor Otwell contributed a new TrustHosts middleware, configuring a whitelist of trusted hosts in the Illuminate request object. By default, the HTTP Foundation configuration is an empty array, so this middleware will help you lock down the hosts (via regex) your application will recognize.

The setting out of the box for Laravel is all subdomains on the configured app.url value. As of Laravel 7, this middleware is opt-in, so you can either uncomment it in a new app or add the following once you upgrade to v7.12:

protected $middleware = [

The bulk of the logic comes from the base middleware class in the framework, and then the Laravel app has an accompanying TrustHosts middleware that extends the framework. You are free to customize and override the base middleware host whitelist logic.

Skip Middleware in Resource Routes

Sébastien Nikolaou contributed the ability to skip middleware from resource routes. Here’s an example from Pull Request #32891:

Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('photo', 'PhotosController')->withoutMiddleware('verified');

Release Notes

You can see the full list of new features and updates below and the diff between 7.11.0 and 7.12.0 on GitHub.

Note: the official release notes were not available at the time of writing, you can always see the latest in CHANGELOG-7x.



  • Added Illuminate\Http\Middleware\TrustHosts (9229264)
  • Ability to skip middleware from resource routes (#32891)


  • Fixed Queued Mail MessageSent Listener With Attachments (#32795)
  • Added error clearing before sending in Illuminate\Mail\Mailer::sendSwiftMessage() (#32799)
  • Avoid foundation function call in the auth component (#32805)
  • Fixed inferred table reference for Illuminate\Database\Schema\ForeignIdColumnDefinition::constrained() (#32847)
  • Fixed wrong component generation (73060db)
  • Fixed bug with request rebind and url defaults in Illuminate\Routing\UrlGenerator (6ad92bf)
  • Fixed Illuminate\Cache\ArrayStore::increment() bug that changes expiration to forever (#32875)


  • Dont cache non objects in Illuminate/Database/Eloquent/Concerns/HasAttributes::getClassCastableAttributeValue() (894fe22)
  • Added explicit symfony/polyfill-php73 dependency (5796b1e)
  • Set Cache\FileStore file permissions only once (#32845, 11c533b)
  • Added alias as key of package’s view components (#32863)
Paul Redmond photo

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.


Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Forge
Kirschbaum logo


Providing innovation and stability to ensure your web application succeeds.

Shift logo


Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Bacancy logo


Supercharge your project with a seasoned Laravel developer with 4-6 years of experience for just $2500/month. Get 160 hours of dedicated expertise & a risk-free 15-day trial. Schedule a call now!

LoadForge logo


Easy, affordable load testing and stress tests for websites, APIs and databases.

Paragraph logo


Manage your Laravel app as if it was a CMS – edit any text on any page or in any email without touching Blade or language files.

Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. Partner with Lucky Media, your favorite Laravel Development Agency!

Lucky Media
Lunar: Laravel E-Commerce logo

Lunar: Laravel E-Commerce

E-Commerce for Laravel. An open-source package that brings the power of modern headless e-commerce functionality to Laravel.

Lunar: Laravel E-Commerce
Laravel Forge logo

Laravel Forge

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Forge
Oh Dear logo

Oh Dear

Oh Dear is the best all-in-one monitoring tool for all your Laravel apps.

Oh Dear
Tinkerwell logo


The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.


The latest

View all →
FrankenPHP v1.0 is Here image

FrankenPHP v1.0 is Here

Read article
Self-healing URLs in Laravel image

Self-healing URLs in Laravel

Read article
Laravel 10.35 Released image

Laravel 10.35 Released

Read article
Solve n+1 queries in PHP with Scout APM image

Solve n+1 queries in PHP with Scout APM

Read article
Show Outdated Composer Dependencies in Laravel Pulse image

Show Outdated Composer Dependencies in Laravel Pulse

Read article
Announcing Laravel Pulse - A New Performance Monitoring Tool for Laravel Apps image

Announcing Laravel Pulse - A New Performance Monitoring Tool for Laravel Apps

Read article