Define a Route Group Controller in Laravel 8.80
Published on by Paul Redmond
The Laravel team released 8.80 with the ability to define a route group controller, render a string with the Blade compiler, PHPRedis serialization and compression config support, and the latest changes in the v8.x branch.
Specify a Route Group Controller
Luke Downing contributed the ability to define a controller for a route group, meaning you don't have to repeat which controller a route uses if the group uses the same controller:
Route::controller(PlacementController::class) ->prefix('placements') ->as('placements.') ->group(function () { Route::get('', 'index')->name('index'); Route::get('/bills', 'bills')->name('bills'); Route::get('/bills/{bill}/invoice/pdf', 'invoice')->name('pdf.invoice'); });
Render a String With Blade
Jason Beggs contributed a Blade::render()
method that uses the Blade compiler to convert a string of Blade templating into a rendered string:
// Returns 'Hello, Claire'Blade::render('Hello, {{ $name }}', ['name' => 'Claire']); // Returns 'Foo 'Blade::render('@if($foo) Foo @else Bar @endif', ['foo' => true]); // It even supports components :)// Returns 'Hello, Taylor'Blade::render('<x-test name="Taylor" />');
PHPRedis Serialization and Compression Config Support
Petr Levtonov contributed the ability to configure PHPRedis serialization and compression options instead of needing to overwrite the service provider or define a custom driver.
The PR introduced the following serialization options:
- NONE
- PHP
- JSON
- IGBINARY
- MSGPACK
And the following compressor options:
- NONE
- LZF
- ZSTD
- LZ4
These options are now documented in the Redis - Laravel documentation.
Release Notes
You can see the complete list of new features and updates below and the diff between 8.79.0 and 8.80.0 on GitHub. The following release notes are directly from the changelog:
v8.80.0
Added
- Allow enums as entity_type in morphs (#40375)
- Added support for specifying a route group controller (#40276)
- Added phpredis serialization and compression config support (#40282)
- Added a BladeCompiler::render() method to render a string with Blade (#40425)
- Added a method to sort keys in a collection using a callback (#40458)
Changed
- Convert "/" in -e parameter to "" in
Illuminate/Foundation/Console/ListenerMakeCommand
(#40383)