Define a Route Group Controller in Laravel 8.80

Published on by

Define a Route Group Controller in Laravel 8.80 image

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)

Fixed

  • Throws an error upon make:policy if no model class is configured (#40348)
  • Fix forwarded call with named arguments in Illuminate/Filesystem/FilesystemAdapter (#40421)
  • Fix 'strstr' function usage based on its signature (#40457)
Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

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

image
Tinkerwell

Version 4 of Tinkerwell is available now. Get the most popular PHP scratchpad with all its new features and simplify your development workflow today.

Visit Tinkerwell
Laravel Forge logo

Laravel Forge

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

Laravel Forge
Tinkerwell logo

Tinkerwell

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

Tinkerwell
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $7500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

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

Shift
Bacancy logo

Bacancy

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!

Bacancy
Lucky Media logo

Lucky Media

Bespoke software solutions built for your business. We ♥ Laravel

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
LaraJobs logo

LaraJobs

The official Laravel job board

LaraJobs
Larafast: Laravel SaaS Starter Kit logo

Larafast: Laravel SaaS Starter Kit

Larafast is a Laravel SaaS Starter Kit with ready-to-go features for Payments, Auth, Admin, Blog, SEO, and beautiful themes. Available with Vue and Livewire stacks.

Larafast: Laravel SaaS Starter Kit
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Rector logo

Rector

Your partner for seamless Laravel upgrades, cutting costs, and accelerating innovation for successful companies

Rector

The latest

View all →
Rule::array() and whereJsonOverlaps() for MySQL in Laravel 11.7 image

Rule::array() and whereJsonOverlaps() for MySQL in Laravel 11.7

Read article
Optimize Your Eloquent Queries with AI image

Optimize Your Eloquent Queries with AI

Read article
Build Your SaaS In Days With SaaSykit image

Build Your SaaS In Days With SaaSykit

Read article
Moonshine is an Open-source Admin Panel for Laravel image

Moonshine is an Open-source Admin Panel for Laravel

Read article
NativePHP Windows Builds are Here image

NativePHP Windows Builds are Here

Read article
Replicate Laravel PHP Client image

Replicate Laravel PHP Client

Read article