Polyscope——面向 Laravel 的以代理为先的开发环境

Debounceable Queued Jobs in Laravel 13.6.0

发布日期 经过

Debounceable Queued Jobs in Laravel 13.6.0 image

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 runs
RebuildSearchIndex :: 派遣 (文档) -> 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.

拉取请求: #59710 经过 @温德尔阿德里尔

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' ),
],

拉取请求: #59735 经过 @德怀特沃森

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:

Validation:

  • 使固定 digits_between validation 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:

其他:

  • Return null from Cursor::fromEncoded for malformed payloads ( #59699 经过 @bipinks
  • Validate MAC across all decryption keys ( #59742 经过 @ma32kc
  • Use generic TModel in additional places in Factory class ( #59780 经过 @jnoordsij

参考

保罗·雷德蒙德照片

Laravel News 特约撰稿人。全栈 Web 开发人员兼作家。

归档于:
立方体

Laravel 时事通讯

加入超过 4 万名开发者的行列,不错过任何新的技巧、教程等内容。

图像
Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

访问 Laravel Cloud
Tinkerwell 徽标

廷克威尔

Laravel 开发者必备的代码运行器。可在本地和生产环境中体验 AI、自动补全和即时反馈功能。

廷克威尔
几天内即可获得 Laravel 代码审查徽标的专家指导

几天内即可获得 Laravel 代码审查方面的专家指导

专家级代码审查!两位拥有 10 年以上 Laravel 开发经验的开发者将为您提供清晰、实用的反馈,帮助团队构建更优质的应用程序。

几天内即可获得 Laravel 代码审查方面的专家指导
PhpStorm 标志

PhpStorm

首选的 PHP IDE,对 Laravel 及其生态系统提供广泛的开箱即用支持。

PhpStorm
Laravel Cloud 标志

Laravel 云

轻松创建和管理服务器,并在几秒钟内部署 Laravel 应用程序。

Laravel 云
了解 Softtech 的标志

了解软科技

Acquaint Softtech 提供 AI 就绪的 Laravel 开发人员,48 小时内即可上手,每月费用为 3000 美元,没有冗长的销售流程,并提供 100% 退款保证。

了解软科技
Kirschbaum 标志

樱桃树

提供创新和稳定性,确保您的Web应用程序取得成功。

樱桃树
Shift 标志

转移

还在运行旧版本的 Laravel?立即实现 Laravel 自动升级和代码现代化,让您的应用程序保持最新状态。

转移
鱼叉:新一代时间跟踪和发票标志

Harpoon:新一代时间跟踪和发票系统

新一代时间跟踪和计费软件,帮助您的机构规划和预测盈利的未来。

Harpoon:新一代时间跟踪和发票系统
Lucky Media 标志

幸运传媒

Get Lucky Now——拥有十余年经验的 Laravel 开发理想之选!

幸运传媒
SaaSykit:Laravel SaaS 入门套件徽标

SaaSykit:Laravel SaaS 入门套件

SaaSykit 是一个多租户 Laravel SaaS 入门套件,包含运行现代 SaaS 所需的所有功能,例如支付、美观的结账界面、管理面板、用户仪表盘、身份验证、现成组件、统计数据、博客、文档等等。

SaaSykit:Laravel SaaS 入门套件
MongoDB 徽标

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
PHPverse 2026 Returns June 9th image

PHPverse 2026 Returns June 9th

阅读文章
LLPhant: A PHP Generative AI Framework Inspired by LangChain image

LLPhant: A PHP Generative AI Framework Inspired by LangChain

阅读文章
Debounceable Queued Jobs in Laravel 13.6.0 image

Debounceable Queued Jobs in Laravel 13.6.0

阅读文章
Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB image

Build Custom Middleware for Query Performance Monitoring and Optimization in Laravel with MongoDB

阅读文章
Laravel API Starter Kits Are Coming Soon! image

Laravel API Starter Kits Are Coming Soon!

阅读文章
An Opinionated Agent Skill for Building REST APIs in Laravel image

An Opinionated Agent Skill for Building REST APIs in Laravel

阅读文章