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界面 - 新的
WorkerInterruptedevent for observability - 新的
@fontsBlade directive and Vite font optimization runtime - Bulk JSON path assertions in TestResponse
SortDirectionenum support for collections and Arr- Enum support for LazyCollection
keyBy() - Various bug fixes and improvements
什么是新的
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:
使用
Illuminate\Contracts\Queue\Interruptible
;使用
照亮\合约\队列\应该队列
;使用
照亮\基金会\队列\可排队
;班级
ReportJob
实现
应该排队
,
Interruptible{
使用
可排队
;
受保护
布尔值
$stop
=
错误的
;
民众
功能
处理
()
:
空白{
尽管
(
!
$this
->
stop) {
// do work...}}
民众
功能
interrupted
(
整数
$signal)
:
空白{
$this
->
停止
=
真的
;}}
公关稿: #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:
文档类型
html
><
html
><
头
>
@fonts
@迅速地
(
'resources/js/app.js'
)</
头
><
身体
>
{{
$slot
}}</
身体
></
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'
])
公关稿: #59584
Bulk JSON Path Assertions in TestResponse
The testing layer now includes
assertJsonPaths()
和
assertJsonMissingPaths()
methods for asserting multiple JSON values at once.
前:
$响应
->
assertJsonPath
(
'data.id'
,
1
)
->
assertJsonPath
(
'data.name'
,
“泰勒”
)
->
assertJsonPath
(
'meta.count'
,
3
(英文):
后:
$响应
->
assertJsonPaths
([
'data.id'
=>
1
,
'data.name'
=>
“泰勒”
,
'meta.count'
=>
3
,]);
The companion
assertJsonMissingPaths()
method works the same way for asserting absent keys:
$响应
->
assertJsonMissingPaths
([
'密码'
,
'secret_token'
]);
公关稿: #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:
使用
SortDirection
;$已排序
=
$集合
->
sortBy
(
'姓名'
,
descending
:
SortDirection
::
Descending
(英文):
公关稿: #59859
Introducing WorkerInterrupted Event
新的
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
。
公关稿: #59848
isLocked Method Added to Lock Class
The Lock class now includes an
isLocked()
method to check the current lock status.
公关稿: #59791
Enum Support for LazyCollection
keyBy()
LazyCollection::keyBy()
现在接受一个
BackedEnum
, matching the behavior already available in
Collection
. Previously, passing an enum would throw an error when attempting to convert it to a string.
公关稿: #59809
其他修复和改进
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.
升级说明
No breaking changes are expected for typical applications. Review the changelog for PR-by-PR details when upgrading.
参考







