Laravel v13.6.0 introduces debounceable queued jobs — when the same job is dispatched multiple times within a time window, only the last dispatch executes. This release also adds JSON response support for the built-in health route, a new JsonFormatter for logging, Cloudflare Email Service integration, and several internal improvements.
- Debounceable queued jobs with
#[DebounceFor]属性 - JSON responses for the built-in health route (
/up) - New JsonFormatter for structured JSON logging
- Cloudflare Email Service support
- Array of pivot arrays support for
hasAttached - Improved model assertions in testing
- Various bug fixes and performance improvements
什么是新的
Debounceable Queued Jobs
This release adds debouncing support for queued jobs. When the same job is dispatched multiple times within a time window, only the last dispatch executes — earlier dispatches are silently discarded at execution time.
Apply the
#[DebounceFor]
attribute to any
ShouldQueue
工作:
使用
照亮\合约\队列\应该队列
;使用
Illuminate\Queue\Attributes\DebounceFor
;#[
DebounceFor
(
30
)]班级
RebuildSearchIndex
实现
应该排队{
使用
可调度
,
与队列交互
,
可排队
;
民众
功能
__构造
(
民众
整数
$documentId) {}
民众
功能
debounceId
()
:
细绳{
返回
(
细绳
)
$this
->
documentId;}
民众
功能
处理
()
:
空白{
搜索索引
::
rebuild
(
$this
->
documentId);}}// User edits a document 10 times in 30 seconds — only the last dispatch runsRebuildSearchIndex
::
派遣
(文档)
->
ID);
Debouncing can also be applied at the dispatch site without modifying the job class:
派遣
(
新的
SyncExternalData
($accountId))
->
debounceFor
(
30
(英文):
A
maxWait
parameter caps how long a job can be deferred:
#[
DebounceFor
(
30
,
maxWait
:
120
)]班级
SyncDashboard
实现
应该排队
{
...
}
This differs from
ShouldBeUnique
— with debounce, the last dispatch wins (at execution time), while
ShouldBeUnique
rejects additional dispatches at dispatch time.
拉取请求: #59507 经过 @matthewnessworthy
JSON Responses for Health Route
The framework's built-in health route (
/up
) now returns JSON when the request expects JSON. Previously, the route always rendered HTML, which was awkward for API-only applications whose load balancers and uptime monitors expect JSON.
什么时候
$request->expectsJson()
is true,
/up
now returns:
{
“地位”
:
"Application is up"
}
Or when a
DiagnosingHealth
listener throws and debug mode is off:
{
“地位”
:
"Application experiencing problems"
}
Status codes (200 / 500) remain unchanged, and non-JSON requests continue receiving the existing Blade page.
JsonFormatter
新的
JsonFormatter
provides structured JSON logging output, useful for log aggregation systems like the ELK stack or Datadog:
使用
Monologue\Handler\StreamHandler
;使用
独白\日志
;使用
照明\支持\立面\日志
;$处理程序
=
新的
流处理程序
(
'php://stdout'
(英文):$处理程序
->
设置格式化程序
(
新的
\Illuminate\Log\Formatters\JsonFormatter
(英文):日志
::
建造
([
“处理员”
=>
$handler])
->
信息
(
用户已登录
,[
'用户身份'
=>
1
]);
拉取请求: #59756 经过 @cosmastech
Cloudflare Email Service Support
Laravel now supports Cloudflare Email Service for sending emails through Cloudflare's infrastructure. Configure the transport in
config/services.php
:
'cloudflare'
=>
[
'account_id'
=>
环境
(
'CLOUDFLARE_ACCOUNT_ID'
),
'token'
=>
环境
(
'CLOUDFLARE_TOKEN'
),],
Array of Pivot Arrays for
hasAttached
The factory
hasAttached
method now accepts an array of pivot arrays, making it easier to create models with different pivot values:
$用户
=
用户
::
工厂
()
->
hasAttached
(
角色
::
工厂
()
->
数数
(
2
), [[
'行政'
=>
'Y'
],[
'行政'
=>
'N'
],])
->
创造
();
拉取请求: #59723 经过 @jackbayliss
Improved Model Assertions
Database model assertions in tests now accept arrays, allowing you to check multiple records in a single call:
$this
->
断言数据库有
(
用户
::班级
,[[
'姓名'
=>
“爱丽丝”
,
'电子邮件'
=>
'alice@example.com'
],[
'姓名'
=>
“鲍勃”
,
'电子邮件'
=>
'bob@example.com'
],]);$this
->
断言数据库缺失
(
用户
::班级
,[[
'姓名'
=>
'Charlie'
,
'电子邮件'
=>
'charlie@example.com'
],]);
拉取请求: #59752 经过 @jackbayliss
其他修复和改进
Queue:
- 确保
Queue::routestring defaults to queue only ( #59711 经过 @jackbayliss ) - Support named credential providers for SQS queue connections ( #59733 经过 @kieranbrown )
Validation:
- 使固定
digits_betweenvalidation rule on non-string values ( #59717 经过 @sumaiazaman ) - Cast to string before preg_match in decimal, max_digits, and min_digits rules ( #59739 经过 @sumaiazaman )
Enum Support:
- Add enum support to PasswordBrokerManager ( #59714 经过 @sumaiazaman )
- Add enum support to BroadcastManager ( #59713 经过 @sumaiazaman )
- Add enum support to NotificationChannelManager ( #59783 经过 @yousefkadah )
其他:
- Return null from
Cursor::fromEncodedfor malformed payloads ( #59699 经过 @bipinks ) - Validate MAC across all decryption keys ( #59742 经过 @ma32kc )
- Use generic TModel in additional places in Factory class ( #59780 经过 @jnoordsij )
参考





