I’m Daniël, CTO of Pionect, a software development company based in Rotterdam. We’re excited to attend Laracon EU on Feb 5 & 6. Pionect has been a long-time sponsor of Laracon, and this year we will be there with our team of developers. Are we finally going to uncover what Taylor has planned for us with Laravel Reverb? Is it the successor to Laravel Echo, or can we expect something entirely different?
We’re anticipating the latest major Laravel 11 release during the event. Let’s take a look at what to expect.
Changes to Laravel Middleware
In the new Laravel 11 project structure, the middleware directory is no longer present by default. You can extend the default Laravel middleware within the App/ServiceProvider, which allows for a cleaner structure. This means that your project will only contain middleware that is specific to your project, ensuring a more streamlined and organised codebase.
Changes to Model Casts
In Laravel 11, model casts are now defined as methods instead of properties. This change allows for calling other methods directly from the casts. For instance, take a look at this example which uses the new Laravel 11’s AsEnumCollection:
protected function casts(): array { return [ 'status' => AsEnumCollection::of(ProductStatus::class), ]; }
In this case, ‘status’ is cast as an enum through AsEnumCollection from the ProductStatus class. This allows for more expressive interaction with the ‘status’ attribute, even if it’s stored as an integer or string in the database.
Simplified Config
Starting with Laravel 11, configurations will be significantly streamlined. All values to be configured will be added directly to the .env file, keeping Laravel’s configuration files within Laravel itself. To customize these configurations, the new `config:publish` command allows you to publish them into your project.
Fewer Route Files
A default installation will now include only two route files: `console.php` and `web.php`. The familiar `api.php` route file can be added by executing the `php artisan install:api` command.
Removal of Console Kernel
The Console Kernel is set to be removed, allowing you to directly define your console commands within the `routes/console.php` file instead. PHP 8.2 is the minimum version required for Laravel 11. In conclusion, Laravel 11 promises exciting changes aimed at streamlining and improving the coding experience. As we look forward to attending Laracon EU, we’re eager to discover more about Laravel 11 and the intriguing Laravel Reverb. See you at the Pionect booth!