Reading Time: 3 minutes

Laravel

Laravel 11: Release Date and New Features

It's the last quarter of the year and I'm getting more and more excited about the upcoming Laravel 11 release. Let's wrap it up!

Release Date

The current Support Policy says that Laravel 11 is going to be released in the first quarter of 2024. We can read on other blogs that the planned release date is February 6th, 2024.

New Features

Laravels mayor release usually introduce more of breaking changes than big feature bumps. The biggest change of Laravel 11 is going to be the slimmed skeleton. Read more about it below.

What do we know about the new skeleton?

Based on the pull request of Taylor Otwell we know that there is going be alot of changes. I'll dive into it for you, so you don't have to.

Configuration

All config files are going to have framework counterparts, which will merged with the applications configration. The default config files will use more environment variables, so your .env becomes more powerful.

Middleware

Authenticate middleware and AuthenticationException are getting new redirectUsing methods, which are accepting Closures. A new introduced Middleware application builder class (you'll read about it later) will help you to define these Closures. The Closure controls where unauthenticated users are going to be redirected.

The Authenticate middleware will not return a redirect when the Request is expecting JSON.

RedirectIfAuthenticated is going to be part of the framework. The middleware will also include a redirectUsing, which can be defined via helpers in the Middleware application builder class.

The AuthenticateSession middleware will also have a redirectUsing function, whiches Closure can be defined via the Middleware application builder class.

TrimStrings will have an except method, to define which strings should not be trimmed.

ValidateCsrfToken will have an except method, to define which paths should not be CSRF token validated.

The ValidateSignature middleware will have an except method, to define which parameters are not included in the signature validation.

TrustHosts will allow all subdomains of the application URL by default.

TrustProxies will be trusting all proxies by default.

The EncryptCookies middleware will have an static except method, to define which cookies should not be encrypted.

Events

The EventServiceProvider will discover events by default. The SendEmailVerificationNotification will be attached automatically to the Registered event.

Artisan Commands

A few commands are getting aliases to have them all under the namespace make.

  • cache:table will have an alias make:cache-table
  • notifications:table will have an alias make:notifications-table
  • queue:batches-table will have an alias make:queue-batches-table
  • queue:failed-table will have an alias make:queue-failed-table
  • queue:table will have an alias make:queue-table
  • session:table will have an alias make:session-table

A schedule command will be added to closure commands, allowing the fluent scheduling of closure commands in the console routes file.

The console scheduler will be available under a Schedule facade.

Service Providers

The RegisterProviders class will be able to load additional providers from bootstrap/providers.php.

make:provider will automatically add the new service provider to bootstrap/providers.php, if the file exists.

The ServiceProvider has a new static addProviderToBootstrapFile method to add a service provider to bootstrap/providers.php, if the file exists.

Application Configuration

The Application class will get a few neew methods and helpers:

  • getBootstrapProvidersPath: Returns the location to the bootstrap providers file.
  • handleRequest and handleCommands: Clean up and simplify the application level bootstrap / index files.
  • configure: Allow the fluent configuration of multiple framework features, including routing and container bindings.

A new ApplicationBuilder will allow the easy configuration of a variety of core framework functionality, including routing, commands, middleware, exception handling, booting / booted callbacks, and more.

The above mentioned Middleware application builder class will be introduced to allow definition of new middleware groups, prepending and appending of middleware to existing groups, replacing middleware in existing groups and fluent methods for enabling middleware like TrustHosts and EnsureFrontendRequestsAreStateful.

The exception handler will get dontReport, dontReportDuplicates, dontFlash and buildContextUsing methods.

Installers

The install:api command will be added to install laravel/sanctum and uncomment the API routes in the bootstrap file.

The install:broadcasting command will be added to uncomment the channels routes in the bootstrap file. Additonally a Laravel Echo file will be written to the resources/js directory which contains the Echo configuration. A directive to include this file is injected into the main bootstrap.js file.


As you can see, alot of changes are waiting for us. This pull request is still in progress, so there might be additional changes.

🔥 Hottest Posts

Laravel

Check Your Laravel Version

Often when you are planning to upgrade your application or you are running into an issue you need to know your Laravel version. Let's find out about 5 ways to check your Laravel version.

My content directly in your inbox?

Sign up for my newsletter.

I care about your data. Read my privacy policy.