Use a String as a Custom Primary Key for Eloquent Table In Laravel
Laravel, renowned for its developer-friendly features, is set to unveil its latest iteration, Laravel 11, promising an array of enhancements and innovations. In this comprehensive guide, we delve into the release date of Laravel 11 and highlight the exciting features that await developers.
Laravel's Evolution: Laravel has solidified its position as a preferred PHP framework for web development, thanks to its continual evolution with each new version. With Laravel 11, developers can anticipate a significant leap forward in terms of functionality and performance.
Release Date: Scheduled to debut on March 12th, 2024, Laravel 11's release marks a pivotal moment for web developers. However, it's important to note that immediate updates may not be necessary, as Laravel 10 will continue to receive support until August 6th, 2024, ensuring a smooth transition period.
New Features and Enhancements: Laravel 11 introduces several groundbreaking features aimed at elevating the development experience:
PHP 8.2 Minimum Support: Laravel 11 mandates PHP 8.2, reflecting its commitment to leveraging the latest advancements in PHP. This ensures developers can harness the full potential of the language's features and enhancements.
return Application::configure()
->withProviders ()
->withRouting(
web: __DIR__.'/../routes/web.php'
commands: __DIR__.'/../routes/console.php',
)
->withMiddleware(function(Middleware Smiddleware) {
$middleware->web(append: LaraconMiddleware::class):
})
Streamlined Directory Structure: Laravel 11 introduces a streamlined directory structure, offering greater flexibility and organization. Notable changes include controllers no longer extending anything by default and the removal of the middleware directory.
public function boot(): void
{
EncryptCookies::except(['some_cookie']);
}
Model Casts Changes: Model casts are now defined as a method, allowing for more versatility. This enables developers to call other methods directly from the casts, enhancing flexibility and extensibility.
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
'password' => 'hashed',
'options'=> AsEnumCollection::of(UserOption::class),
];
}
Config Changes: Laravel 11 simplifies configuration management by removing numerous configuration files and adopting a cascading configuration approach. The .env file now encompasses all necessary settings, with the option to publish configuration files as needed. We've introduced a new command, config:publish
designed to streamline your configuration management. With this command, you can effortlessly retrieve any configuration file you need to restore.
Slimmed Default Migrations: Default migrations from previous years have been consolidated into two files, resulting in a cleaner and more manageable database/migrations directory for new projects.
Routes Changes: Laravel 11 restructures default route files for enhanced simplicity and modularity. API routes and WebSocket broadcasting now follow an opt-in approach, offering greater customization and control.
Developers will now have the flexibility to choose whether to incorporate API routes and Laravel Sanctum into their projects. This can be achieved seamlessly through the command:
php artisan install:api
Likewise, WebSocket broadcasting will now adhere to an opt-in methodology. To integrate WebSocket broadcasting functionality seamlessly, developers can utilize the command:
php artisan install:broadcasting
Console Kernel Removed: The dedicated Console Kernel file is replaced with a more streamlined approach to defining console commands directly in the routes/console.php file, simplifying application configuration.
Preparation for the Laravel 11 release is well underway! Here's a glimpse of the merged PRs that have been incorporated:
And there's even more in store! Stay tuned for further updates as we continue to refine and enhance Laravel for its upcoming release.
Subscribe to the Email Newsletter