News

Failover Queue Driver in Laravel 12.34

Published
Failover Queue Driver in Laravel 12.34 image

Release updates

Never miss a Laravel release

Get an email whenever a new Laravel release lands.

The Laravel team released version 12.34.0, introducing a failover queue driver, full-text database search improvements in Laravel Scout, deferring an HTTP client batch, and more.

Failover Queue Driver

Taylor Otwell added a failover queue driver that provides automatic failover when pushing to a queue. When the primary queue connection fails, the failover driver will push the job to the next configured connection.

'failover' => [
'driver' => 'failover',
'connections' => [
env('QUEUE_CONNECTION', 'database'),
'sync',
],
],

See Pull Request #57341 for implementation details. Also, learn how to configure the failover driver in the Queues documentation.

Full-text Improvements in Laravel Scout

Taylor Otwell added full-text improvements to Laravel Scout when using the database engine. When using Postgres, and no other ordering has been defined, it automatically uses relevancy-based order by default to match MySQL's ordering behavior.

If you are using Laravel Scout, update to the latest version using Composer to get these updates. See laravel/scout Pull Request #947 for details.

Editor Support Updates for the Local Exception Page

Multiple contributors added support for new editor links on the local exception page. You can configure the app.editor value to match a supported editor link found in ResolvesDumpSource.php.

Here's a list of new editors added in Laravel 12.34:

Closure Support for throw_if

Chris Page contributed Closure support for the throw_if exception parameter:

// By wrapping it in a closure, it'll only be evaluated when our if is truthy
throw_if($apiResponse instanceof CustomResponse, fn() => new \Exception($apiResponse->message));

HTTP Batch Defer Method

Wendell Adriel originally contributed the Http Client Batch Method in Laravel 12.32. In this release, he's added a defer() method that follows the same pattern used in Concurrency.

The use case for this is if you want to batch requests after returning the response, but you want to trigger actions with the hooks:

Http::batch(fn (Batch $batch) => [
$batch->get('https://example.com/endpoint-1'),
$batch->get('https://example.com/endpoint-2'),
])->before(function (Batch $batch) {
// The batch has been created but no requests have been initialized...
})->progress(function (Batch $batch, int|string $key, Response $response) {
// An individual request has completed successfully...
})->then(function (Batch $batch, array $results) {
// All requests completed successfully...
})->catch(function (Batch $batch, int|string $key, Response|RequestException $response) {
// First batch request failure detected...
})->finally(function (Batch $batch, array $results) {
// The batch has finished executing...
})->defer();

See Pull Request #57387 for more details.

Release notes

You can see the complete list of new features and updates below and the diff between 12.33.0 and 12.34.0 on GitHub. The following release notes are directly from the changelog:

v12.34.0

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Sponsored

laravelcloud logo
Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Visit Laravel Cloud

The latest

View all →
CPX: The Composer Package Executor for PHP image

CPX: The Composer Package Executor for PHP

Read article
Laravel AI SDK Adds Human-in-the-Loop Tool Approval image

Laravel AI SDK Adds Human-in-the-Loop Tool Approval

Read article
Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals image

Pest 5 Released With Test Impact Analysis, Agent Verification, and Evals

Read article
Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs image

Queue-SQL: Run Mass Deletes and Updates Across Parallel Queue Jobs

Read article
Blade Formatting in Laravel Pint image

Blade Formatting in Laravel Pint

Read article
Inertia DevTools Is Now on the Chrome Web Store image

Inertia DevTools Is Now on the Chrome Web Store

Read article