Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Interruptible Jobs in Laravel 13.7.0

Last updated on by

Interruptible Jobs in Laravel 13.7.0 image

Laravel v13.7.0 introduces the Interruptible interface for queued jobs to respond to worker signals, a new @fonts Blade directive for Vite font optimization, bulk JSON path assertions for testing, SortDirection enum support in collections, and several other improvements across the framework.

  • Jobs can now react to worker signals via the Interruptible interface
  • New WorkerInterrupted event for observability
  • New @fonts Blade directive and Vite font optimization runtime
  • Bulk JSON path assertions in TestResponse
  • SortDirection enum support for collections and Arr
  • Enum support for LazyCollection keyBy()
  • Various bug fixes and improvements

What's New

Jobs Can React to Worker Signals

Queued jobs can now implement the Interruptible interface to respond when a worker receives a signal like SIGTERM. This lets long-running jobs clean up or set a stop flag before the worker exits:

use Illuminate\Contracts\Queue\Interruptible;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
 
class ReportJob implements ShouldQueue, Interruptible
{
use Queueable;
 
protected bool $stop = false;
 
public function handle(): void
{
while (! $this->stop) {
// do work...
}
}
 
public function interrupted(int $signal): void
{
$this->stop = true;
}
}

PR: #59833

New @fonts Blade Directive and Vite Font Optimization

This release adds a new @fonts Blade directive and Vite::fonts() method for rendering font preload links and inline styles. The feature reads font manifests generated by the Vite plugin and supports selective family loading.

Basic usage in your layout:

<!DOCTYPE html>
<html>
<head>
@fonts
@vite('resources/js/app.js')
</head>
<body>
{{ $slot }}
</body>
</html>

This renders preload <link> tags and an inline <style> block with all @font-face rules and CSS variables from the font manifest.

You can also filter to load only specific font families:

{{-- Load a single family --}}
@fonts('sans')
 
{{-- Load multiple families --}}
@fonts(['sans', 'mono'])

PR: #59584

Bulk JSON Path Assertions in TestResponse

The testing layer now includes assertJsonPaths() and assertJsonMissingPaths() methods for asserting multiple JSON values at once.

Before:

$response->assertJsonPath('data.id', 1)
->assertJsonPath('data.name', 'Taylor')
->assertJsonPath('meta.count', 3);

After:

$response->assertJsonPaths([
'data.id' => 1,
'data.name' => 'Taylor',
'meta.count' => 3,
]);

The companion assertJsonMissingPaths() method works the same way for asserting absent keys:

$response->assertJsonMissingPaths(['password', 'secret_token']);

PR: #59829

SortDirection Enum Support for Collections

Collections and the Arr class now support the SortDirection enum for specifying sort order, providing better type safety when sorting:

use SortDirection;
 
$sorted = $collection->sortBy('name', descending: SortDirection::Descending);

PR: #59859

Introducing WorkerInterrupted Event

A new WorkerInterrupted event is dispatched when a worker receives a signal, before it stops. This is useful for observability — you can log, alert, or call an external service when a signal arrives, even if the individual job doesn't implement Interruptible.

PR: #59848

isLocked Method Added to Lock Class

The Lock class now includes an isLocked() method to check the current lock status.

PR: #59791

Enum Support for LazyCollection keyBy()

LazyCollection::keyBy() now accepts a BackedEnum, matching the behavior already available in Collection. Previously, passing an enum would throw an error when attempting to convert it to a string.

PR: #59809

Miscellaneous Fixes and Improvements

This update includes enum support improvements across ConcurrencyManager, QueueManager, LogManager, SessionManager, and RedisManager. Various docblock improvements, type corrections, and bug fixes from community contributors are also included.

Upgrade Notes

No breaking changes are expected for typical applications. Review the changelog for PR-by-PR details when upgrading.

References

Paul Redmond photo

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

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
MongoDB logo

MongoDB

Enhance your PHP applications with the powerful integration of MongoDB and Laravel, empowering developers to build applications with ease and efficiency. Support transactional, search, analytics and mobile use cases while using the familiar Eloquent APIs. Discover how MongoDB's flexible, modern database can transform your Laravel applications.

MongoDB

The latest

View all →
A Free Shift to Check If Your App is Ready for Laravel Cloud image

A Free Shift to Check If Your App is Ready for Laravel Cloud

Read article
Laravel Idempotency: HTTP Idempotency Middleware for Laravel image

Laravel Idempotency: HTTP Idempotency Middleware for Laravel

Read article
Polyscope for Windows is Now Available image

Polyscope for Windows is Now Available

Read article
Laravel Sluggable image

Laravel Sluggable

Read article
Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13 image

Ship AI with Laravel: RAG with Embeddings and pgvector in Laravel 13

Read article
Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes image

Laravel Mobile Pass: Generate Apple Wallet and Google Wallet Passes

Read article