Laravel 11: New Features and Updates
Laravel, the ever-evolving PHP framework, has been synonymous with web development excellence for years. The release of Laravel 11 is on the way that promises new features to push the boundaries of web development and unlock a whole new era of possibilities. In what follows, we’ll explore the exciting new features and updates that await you in this revolutionary framework.
When Will Laravel 11 Be Released?
Laravel follows a predictable release schedule. Major versions with potential breaking changes come out yearly (around Q1), while minor and patch updates arrive weekly and never break compatibility.
Based on this pattern, Laravel 11 is expected to be released in February 2024, during the first quarter.
Enhance your web applications with our expert custom Laravel development services.
How to Install Laravel 11?
While Laravel 11 isn’t officially out yet, you can still explore its cutting-edge features by installing the development version. Here’s how:
1. Using the Laravel Installer
Open your terminal and run this command:
laravel new projectname --dev
This command fetches the latest code from the master branch of the Laravel repository, giving you a taste of what’s to come in Laravel 11.
2. Using Composer Directly
If you prefer Composer, use this command instead:
composer create-project --prefer-dist laravel/laravel projectname dev-master
This approach also sets you up with the development version of Laravel 11.
Laravel 11: Latest Features and Updates
Laravel 11 is still under development, but there are some exciting features and updates we can expect based on early access and merged pull requests. The supposedly upcoming features of Laravel 11 are:
- Slim Skeleton
- Dropped Support for PHP 8.1
- Doctrine DBAL Removal
- Added Support for Eager Loading with Limit
- Database Floating-Types Refactored
- Database Spatial Types Refactored
- Secure Randomness in Array Helpers
- Dedicated Database Configs for MariaDB
- Per-Second Rate Limiting
1. Slim Skeleton
By Taylor Otwell on laravel/framework#47309 and laravel/laravel#6188
Laravel 11 unveils a slimmer and sleeker application Skeleton that prioritizes efficiency and code minimalism. This minimalistic skeleton enables developers to start building faster and with less clutter. Key changes include:
- Drastically reduced service providers, middleware, and configuration files, with customization now primarily handled within the new
bootstrap/app.php
file. - Automatic discovery of policies and events, eliminating manual registration.
- User model updates and removal of “Sanctum” by default, offering a cleaner starting point.
- Environment variables expanded and renamed for clarity, and default queue connection set to
database
. - Migrations consolidated and re-dated for evergreen setups.
2. Dropped Support for PHP 8.1
By Dries Vints on laravel/framework#45526
Laravel 11 is making waves in the web development world with its bold decision to leapfrog over PHP 8.1 and directly support the upcoming versions, 8.2 and 8.3.
This forward-thinking move signals Laravel’s commitment to staying at the forefront of PHP technology, leaving behind past iterations for the exciting possibilities of the future.
Instead of getting bogged down with compatibility concerns for an already established PHP version, Laravel 11 sets its sights on the horizon by embracing the new features and performance enhancements that 8.2 and 8.3 have to offer.
This allows developers to use the latest advancements in PHP right from the get-go, and build cleaner, faster, and more efficient web applications.
Read more: Is Laravel good for Startup? Why it is the Best PHP Framework for Startups?
3. Doctrine DBAL Removal
By Hafez Divandari on laravel/framework#48864
Laravel 11 is dropping Doctrine DBAL and moving to native database schema methods. This brings several improvements, including:
- Simplified Codebase: Removing Doctrine DBAL reduces complexity and makes the framework easier to maintain.
- Native Column Modification: Laravel now supports native column modification, renaming, and dropping on all database drivers including SQLite and legacy MySQL versions.
- Improved Artisan Commands:
db:show
,db:table
, andmodel:show
commands are rewritten for better performance and readability. - Additional Features: User-defined types (PostgreSQL) and schema information (PostgreSQL, SQL Server) are accessible through artisan commands. Also, SQLite now supports
collation
for columns.
Read more: Which Front-end Framework is Best for Laravel?
4. Added Support for Eager Loading with Limit
By Jonas Staudenmeir on laravel/framework#49695
It wasn’t possible to use the `limit` and `take` query builder methods when constraining eager loads. It’s now fixed on Laravel 11:
User::with(['posts' => function ($query) {
$query->latest()->limit(10);
}])->get();
5. Database Floating-Types Refactored
By Hafez Divandari on laravel/framework#48861
Laravel 11 is streamlining floating-point column types across databases and removing unsigned options for consistency and compatibility.
Key Reasons For These Changes:
- Aligning with Database Standards: Most databases allow passing precision to float type to choose between standard 4-byte and 8-byte storage, respectively. Laravel is adjusting its syntax to match.
- Addressing MySQL Deprecations: MySQL 8.0.17 deprecated certain syntax and unsigned attributes for floating-point types, motivating Laravel to adapt.
Specific Changes Being Made:
- Consistent Float and Double Definitions:
- Blueprint’s
float
method now accepts$precision
argument instead of$total
and$scale.
- Blueprint’s
double
method doesn’t accept$total
and$scale
arguments anymore.
- Removal of Unsigned Options:
$blueprint->unsignedFloat()
,$blueprint->unsignedDouble()
, and$blueprint->unsignedDecimal()
are being removed.
6. Database Spatial Types Refactored
By Hafez Divandari on laravel/framework#49634
Laravel 11 is revamping its handling of spatial data types across MySQL, PostgreSQL (with PostGIS), SQL Server, and SQLite (with SpatiaLite) to ensure consistent behavior and wider compatibility. This also addresses some existing inconsistencies and limitations.
Why the Change?
- Previous Inconsistencies: Spatial data usage and results vary across databases, making it hard to predict.
- Confusing Defaults: The default
geometry
type automatically maps togeography
, and causes confusion. - PostgreSQL Conflicts: Native PostgreSQL types clash with implemented PostGIS types, especially for points and polygons.
- Limited PostGIS Support: Laravel couldn’t use the full range of PostGIS subtypes for geometry and geography.
What’s New?
- Unified
geometry
andgeography
Types: Both accept optional subtype and SRID (Spatial Reference System Identifier) parameters. - Subtype Support: Laravel now recognizes specific subtypes for MySQLand PostGIS.
- Full PostGIS Subtype Access: Laravel can now utilize all PostGIS geometry and geography subtypes.
- SQL Server
geometry
Recognition: Spatial types are correctly mapped to their respective database types.
7. Secure Randomness in Array Helpers
By Stephen Rees-Carter on laravel/framework#49642
Laravel 11 takes a bold step towards bolstering randomness security within its core array helpers.
- Enhancing Randomness Security:
Arr::random()
andArr::shuffle()
, along with their Collection counterparts, are being upgraded to use secure randomness functions. - Addressing Previous Vulnerabilities:
Str::password()
‘s insecure shuffle has been fixed. - Considering a Standalone Random Class: The potential of incorporating a dedicated Random class into Laravel’s core is being explored.
- Removing Seed Functionality: The
$seed
parameter forshuffle()
has been removed to promote explicit and consistent randomness implementation within the code.
8. Dedicated Database Configs for MariaDB
By Julius Kiekbusch on laravel/framework#48455
Laravel 11 is enhancing its compatibility with MariaDB by introducing dedicated configuration options and adopting recommended collations.
Key Changes:
- Separate Configuration: MariaDB now has its own configuration section, distinct from MySQL, for tailored settings.
- Collation Updates:
- Default collation for MySQL is now
utf8mb4_0900_ai_ci.
- Default collation for MariaDB is now
utf8mb4_uca1400_ai_ci
.
- Testing: MariaDB configuration is being tested specifically against MariaDB databases to ensure consistency.
9. Per-Second Rate Limiting
By Tim MacDonald on laravel/framework#48498
Laravel 11 is expanding its rate-limiting capabilities by natively supporting per-second limits.
- Direct Per-Second Control: Developers can now define rate limits based on seconds using
Limit::perSecond()
. - Flexible Configuration: Per-second limits can be combined with existing per-minute limits for granular control.
- Enhanced Protection: Mitigates request bursts and smooths out traffic patterns for improved performance and security.
Laravel 11 vs. Laravel 10
The latest version of Laravel, Laravel 11, builds on the improvements of Laravel 10.x by offering several enhancements. These include:
- a more organized application structure,
- the ability to limit requests by rate per second,
- health checks with built-in routing,
- a secure way to rotate encryption keys,
- improved queue testing functionalities,
- the ability to resend emails
- integration with the Prompt validator for better validation, and
- a collection of new Artisan commands.
Furthermore, Laravel introduces Reverb, a scalable WebSocket server developed by Laravel itself, to empower your applications with robust real-time capabilities.
Why Should Businesses Upgrade to Laravel 11?
Upgrading to Laravel 11 offers significant benefits for businesses, from enhanced performance and security to improved developer experience and access to new features.
While every project has unique considerations, the overall advantages of Laravel 11 make it a compelling choice for businesses looking to modernize and future-proof their web applications.Read more: Laravel vs. CodeIgniter: Which One is Better?
Below you can find 5 reasons why businesses should consider upgrading to Laravel 11:
- Faster: Laravel 11 boasts performance improvements under the hood, including optimized database queries, better caching mechanisms, and improved routing.
This can translate to faster loading times and a smoother user experience for your customers. - More Secure: Laravel 11 introduces several security enhancements, including upgraded randomness functions and increased bcrypt rounds to 12.
Additionally, the framework prioritizes secure dependencies and deprecates outdated methods, reducing the attack surface for potential threats. - Smoother Development: Laravel 11 focuses on making developer life easier with improved documentation, error handling, and debugging tools. This can lead to faster development times and reduced frustration for your team.
- More Readable Code: The framework continues its commitment to clean and concise syntax, making code easier to understand and maintain in the long run.
- Improved Database Support: Laravel 11 introduces a dedicated configuration for MariaDB and adopts recommended collations for both MySQL and MariaDB.
Final Words
Laravel 11 marks a bold leap forward in both its features and its philosophy. It takes advantage of the latest technologies, prioritizes developer experience, and lays the foundation for greater innovation in the years to come.
From streamlined development with the slim Skeleton to future-proofed support for PHP 8.2 and 8.3, Laravel 11 is an invitation to develop faster, cleaner, and more secure applications.
We value your input and believe this content may enhance our services. However, it's under review. If you see room for improvement, please use the "Report an issue" button below. Your feedback helps us excel.
Contact us today at –– and speak with our specialist.