eCommerce

Sneak peek: what's coming in Laravel 11 beta

Sneak peek: what's coming in Laravel 11 beta - Zest Logic

Laracon US 2023 has recently concluded, marking a remarkable week filled with exciting product releases, training sessions, inspirational talks, and the joy of reconnecting with old friends and making new ones. Although Laravel 11's official release is scheduled for later this year, some enticing new features have been shared during the conference. Let's look at what to expect from Laravel 11 based on the beta preview.


Streamlined Directory Structure:

In Laravel 11, the directory structure has undergone significant changes. Notably, controllers will no longer extend anything by default, providing more flexibility in organizing your codebase. Additionally, the middleware directory has been removed, and Laravel now includes nine default middleware that can be customized in the App/ServiceProvider. This change empowers developers to fine-tune middleware settings according to their project requirements.


No more Http/Kernel:

The Http/Kernel has been removed in Laravel 11, with its functionalities now available in the Bootstrap/App. This shift streamlines the application setup process, enhancing overall performance and maintainability. Developers can now utilize the "configure" method and other related functions to effectively set up routing and middleware.


Model Casts Changes:

Model casts in Laravel 11 have transitioned from being defined as properties to methods, allowing for more versatility in handling data. Developers can now directly call other methods from the casts, enabling better data manipulation. For example, Laravel 11 introduces a new AsEnumCollection, which can be utilized in the model casts method for more dynamic data handling.


Config Changes:

In Laravel 11, the extensive configuration files have been removed, and all config options now cascade down. The .env file has been expanded to include all the necessary options for convenient configuration. Additionally, the new config:publish command allows developers to selectively bring back any specific configuration they require, while the cascade feature ensures a clean and customized configuration setup.


Slimmed Default Migrations:

The default migrations that come with a fresh Laravel app have been optimized in Laravel 11. The migration files from 2014 and 2019 have been streamlined into just two files, offering a more organized and efficient migration structure.


Routes Changes:

In Laravel 11, there will be only two default route files: console.php and web.php. API routes will become opt-in through the php artisan install:api command, which also enables Laravel Sanctum for API authentication. Similarly, websocket broadcasting can be enabled using php artisan install:broadcasting.


Console Kernel Removed:

Laravel 11 bids farewell to the Console Kernel. Instead, developers can now define console commands directly in the routes/console.php file, simplifying the management of console-related tasks.


PHP 8.2 Minimum Support:

Laravel 11 will require a minimum of PHP 8.2 to leverage the latest language features and enhancements. It's a timely opportunity for developers running older PHP versions to consider upgrading.


Wrap-up:

As Laravel 11 features are currently in beta, further refinements and additions might occur before the official release. These exciting changes are designed to boost your workflow and enhance the Laravel development experience. Stay tuned for updates as Laravel 11 continues to evolve, promising an even more powerful and developer-friendly framework.



In our blog, we post technology-related articles weekly. Follow us on Facebook and Instagram to get notifications about updates.

Reading next

Marketing strategies of the Barbie movie
Is Magento is good choice for your eCommerce project

Interested in a specific business & technology topic and looking for an article in our blog but haven't found one yet?

If you haven't come across an article that matches your query, feel free to suggest the topic to us, and we'll consider featuring it in our blog. Share your suggestion in the form below, and we'll be sure to review your request.

Talk with us

If you have any questions or problems in your business that can be solved with technical solutions, just let us know. We'll do everything we can to help you.