Laravel just dropped a game-changer in version 12.37: Background Queues. If you’ve ever wished your app could feel snappier without setting up Redis, Horizon, or external workers—this update is for you.
⚡ What Are Background Queues?
Background Queues are a new queue connection powered by Concurrently::defer(), contributed by Barry vd. Heuvel. Unlike traditional queue drivers that rely on external services (Redis, SQS, etc.), this driver runs jobs in the background using native PHP processes.
Think of it as deferred dispatching without the overhead. You dispatch a job, and Laravel quietly spins up a background PHP process to handle it—no queue workers, no config headaches.
Basic Dispatch Example
RecordDelivery::dispatch($order)->onConnection('background');
This sends the RecordDelivery job to run asynchronously in the background.
đź§ Why This Matters
Here’s what makes Background Queues a breakthrough:
- Instant UI response: Offload slow tasks (emails, logging, API calls) so users get feedback immediately.
- Zero setup: No Redis, no Horizon, no supervisor daemons—just PHP.
- Perfect for small apps and prototypes: Ideal when you want speed without infrastructure complexity.
- Great for long-running jobs: Since it uses PHP processes, it’s well-suited for heavier tasks that don’t need real-time feedback.
🛠️ How to Use It
- Update to Laravel 12.37.
- Configure the background connection in
config/queue.php:
'connections' => [
'background' => [
'driver' => 'background',
],
],
- Dispatch jobs using the new connection:
SendWelcomeEmail::dispatch($user)->onConnection('background');
No need to run php artisan queue:work. Laravel handles the background process automatically.
Example: Sending a Welcome Email
namespace App\Jobs;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Mail;
class SendWelcomeEmail implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $user;
public function __construct($user)
{
$this->user = $user;
}
public function handle()
{
Mail::to($this->user->email)->send(new \App\Mail\WelcomeMail($this->user));
}
}
Dispatch it in your controller:
SendWelcomeEmail::dispatch($user)->onConnection('background');
🔍 Use Cases That Shine
- Sending emails after form submissions
- Logging analytics events without delaying the response
- Triggering webhooks or third-party API calls
- Generating PDFs or reports post-request
- Image processing or video encoding tasks
Example: Logging Analytics Event
namespace App\Jobs;
class LogAnalyticsEvent implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $eventData;
public function __construct(array $eventData)
{
$this->eventData = $eventData;
}
public function handle()
{
// Simulate sending event data to analytics service
\Log::info('Analytics event logged:', $this->eventData);
}
}
Dispatch:
LogAnalyticsEvent::dispatch(['page' => 'home', 'action' => 'click'])->onConnection('background');
đź§Ş Performance Gains
While exact benchmarks depend on your workload, early adopters report perceived speed improvements of 5x to 10x. That’s because the user-facing response is instant, while the heavy lifting happens behind the scenes.
đź§© When Not to Use It
- High-throughput production apps: You’ll still want Redis or SQS for scale.
- Jobs requiring retries or monitoring: Background Queues are fire-and-forget.
- Shared hosting environments: Background PHP processes may be restricted.
đź§ Final Thoughts
Laravel’s Background Queues are a bold step toward making developer experience frictionless. For solo devs, SaaS builders, and rapid prototypers, this feature unlocks instant-loading UX without infrastructure baggage.
If you’re building tools that need to feel fast, Laravel 12.37 just gave you a powerful new lever.
