Laravel v13.9.0 adds
Password::toPasswordRulesString()
for generating HTML
passwordrules
attributes so browsers and password managers can suggest compliant passwords automatically, along with Cloud queue metrics, optional disk storage for large SQS payloads, and more:
Password::toPasswordRulesString()for HTMLpasswordrules属性- Cloud queue metrics for job processing telemetry
- Optional disk storage for large SQS queue payloads
Concurrency::run()timeout supportPendingDispatchconditionable withwhen()和unless()PreparesForDispatchinterface for pre-dispatch job hooksforeignUuidForschema blueprint helperThrottlesExceptionsbackoff now accepts a Closure- Enum support for contextual attribute binding
什么是新的
Password::toPasswordRulesString()
这
Password
validation rule now has a
toPasswordRulesString()
method that converts a
Password
instance into a
passwordrules
attribute string for HTML inputs.

这
passwordrules
属性是
a specification introduced by Apple
that lets browsers and password managers — including Safari, 1Password, and Bitwarden — read an app's password constraints and generate a valid password automatically, rather than the user having to trial-and-error a suggested password against validation errors.
每个
Password
method maps to a specific rule token:
Password
方法 |
passwordrules
令牌 |
|---|---|
min(n) |
minlength: n |
max(n) |
maxlength: n |
letters() |
required: lower |
mixedCase() |
required: lower; required: upper |
numbers() |
required: digit |
symbols() |
required: special |
uncompromised()
has no
passwordrules
equivalent and is not included in the output.
Here are the outputs for common combinations, verified against the merged tests:
密码
::
分钟
(
8
)
->
toPasswordRulesString
();// 'minlength: 8;'密码
::
分钟
(
8
)
->
最大限度
(
64
)
->
toPasswordRulesString
();// 'minlength: 8; maxlength: 64;'密码
::
分钟
(
8
)
->
字母
()
->
toPasswordRulesString
();// 'minlength: 8; required: lower;'密码
::
分钟
(
8
)
->
大小写混合
()
->
toPasswordRulesString
();// 'minlength: 8; required: lower; required: upper;'密码
::
分钟
(
12
)
->
最大限度
(
64
)
->
大小写混合
()
->
数字
()
->
符号
()
->
toPasswordRulesString
();// 'minlength: 12; maxlength: 64; required: lower; required: upper; required: digit; required: special;'
The most practical use is pairing it with
Password::defaults()
so the same policy you define in
AppServiceProvider
drives both server-side validation and the browser's password suggestions:
// 应用程序/提供商/AppServiceProvider.php密码
::
默认值
(
fn
() =>
密码
::
分钟
(
12
)
->
最大限度
(
64
)
->
大小写混合
()
->
数字
()
->
符号
());
<
输入
类型
=
“密码”
自动完成
=
"new-password"
passwordrules
=
“
{{
密码
::
默认值
()
->
toPasswordRulesString
()
}}
“/>
When a user focuses the field in a supporting browser or password manager, they'll be offered a generated password that already satisfies your rules — no back-and-forth with validation errors.
Cloud Queue Metrics
Three PRs from
@蒂麦克唐纳
add metrics tracking for Laravel Cloud queue connections. The new
Illuminate\Foundation\Cloud\Queue
decorator wraps any queue driver and emits events through a socket when jobs are queued and when processing starts and finishes. This gives Laravel Cloud visibility into job throughput, processing duration, and worker activity.
Config caching is also now supported for Cloud queues — prefix and suffix values are read from the config file rather than environment variables directly, making
php artisan config:cache
work correctly in Cloud deployments.
Optional Disk Storage for Large SQS Payloads
SQS has a maximum message size of 1 MB. When a serialized job payload exceeds that limit, AWS rejects it with an
InvalidParameterValue
error. This release adds a built-in solution: an
extended_store_options
block in the SQS queue connection config that offloads large payloads to a filesystem disk (such as S3) and sends a small pointer through SQS instead. Workers fetch the full payload from disk when processing the job.
// config/queue.php'平方'
=>
[
// ...existing config...
'extended_store_options'
=>
[
‘已启用’
=>
环境
(
'SQS_STORE_ENABLED'
,
错误的
),
'磁盘'
=>
环境
(
'SQS_STORE_DISK'
,
's3'
),
'前缀'
=>
环境
(
'SQS_STORE_PREFIX'
,
“”
),
'always'
=>
错误的
,
'cleanup'
=>
真的
,],],
enabled— turn the feature on or off (defaults tofalse)disk— which filesystem disk to store payloads onprefix— path prefix for stored payload files on the diskalways— whentrue, stores every payload to disk regardless of sizecleanup— whentrue, deletes the disk file after the job is successfully processed
This is opt-in and backwards compatible. Existing SQS users are unaffected unless they set
enabled
到
true
。
Concurrency::run()
Timeout Support
Concurrency::run()
uses the process driver by default, which runs each task through Laravel's process layer. That layer has a default 60-second timeout, but there was no way to customize it from
Concurrency::run()
. A new
timeout
parameter is now available for the process driver:
并发
::
跑步
([
fn
() =>
longRunningTask
(),],
暂停
:
300
(英文):
The fork driver is unchanged because
spatie/fork
does not support task timeouts. The sync driver also keeps its existing behavior since it runs tasks inline.
PendingDispatch
可条件性
PendingDispatch
now implements the
Conditionable
trait, which adds
when()
和
unless()
methods. This lets you configure dispatched jobs inline without wrapping the dispatch call in conditionals:
SendPersonalDetailsToFraudDetectionTool
::
派遣
($customer)
->
什么时候
($customer
->
hasSufficientPersonalDetails
(),
fn
($job) => $job
->
毫不拖延
());SendPersonalDetailsToFraudDetectionTool
::
派遣
($customer)
->
除非
($customer
->
hasSufficientPersonalDetails
(),
fn
($job) => $job
->
延迟
(
180
));
公关稿: #60047 经过 @kevinb1989
PreparesForDispatch
界面
新的
PreparesForDispatch
interface adds a
prepareForDispatch()
method that runs before a job is pushed to the queue. The method can return
false
to cancel the dispatch entirely. This is useful for jobs dispatched from multiple call sites that all need the same pre-dispatch logic — for example, deduplicating IDs or checking whether a job is still needed before consuming queue capacity:
使用
Illuminate\Contracts\Queue\PreparesForDispatch
;班级
SyncPodcastsJob
实现
应该排队
,
PreparesForDispatch{
使用
可排队
;
民众
功能
__构造
(
民众
大批
$podcastIds) {}
民众
功能
prepareForDispatch
()
:
布尔值{
$this
->
podcastIds
=
array_unique
(
$this
->
podcastIds);
返回
数数
(
$this
->
podcastIds)
>
0
;}
民众
功能
处理
()
:
空白{
// ...}}
公关稿: #59879 经过 @jackbayliss
foreignUuidFor
Schema Helper
新的
foreignUuidFor()
method on schema blueprints provides an explicit API for migrations that want a UUID foreign key column. While the existing
foreignIdFor()
already handles UUID-backed models by detecting the key type,
foreignUuidFor()
makes the intent clear and mirrors the same model-aware behavior:
$表
->
foreignUuidFor
(
用户
::班级
)
->
受限制
();
The helper infers the column name, related table name, and referenced primary key column from the model.
公关稿: #60091 经过 @Tresor-Kasenda
ThrottlesExceptions
Backoff Accepts a Closure
这
backoff()
方法
ThrottlesExceptions
middleware now accepts a Closure that receives the throwable. This is useful when the exception carries retry timing information — such as a
Retry-After
header from an external API — and you want to use it directly rather than a fixed backoff value:
(
新的
限制异常
(
maxAttempts
:
10
,
decaySeconds
:
300
))
->
byJob
()
->
什么时候
(
fn
(
可抛出
$e) => $e
实例
ExternalAPIException
&&
$e
->
isRateLimited
())
->
退避
(
fn
(
可抛出
$e) => $e
实例
ExternalAPIException
?
$e
->
retryAfter
()
/
60
:
2),
公关稿: #60103 经过 @cosmastech
Enum Support for Contextual Attribute Binding
这
#[Auth]
,
#[Authenticated]
, 和
#[Cache]
contextual attributes now accept both
UnitEnum
and backed enum values in addition to strings. This lets you use enum cases to reference guards and cache stores in dependency injection:
使用
App\Enums\AuthGuard
;使用
Illuminate\Container\Attributes\Auth
;民众
功能
__构造
(#[
授权
(
AuthGuard
::
行政
)]
受保护
警卫
$adminGuard,){}
公关稿: #60092 经过 @Tresor-Kasenda
其他修复和改进
- Scoped filesystem Cloud support
—
Storage::cloud()now works with scoped disks ( #60030 经过 @jeremynikolic ) - Migration event names
—
MigrationStarted和MigrationEndedevents now include the migration name ( #60059 经过 @jackbayliss ) - Worker timeout exit code override
— The worker timeout exit code can now be customized via
WORKER_TIMEOUT_EXIT_CODE, matching the existingWORKER_MEMORY_EXIT_CODEbehavior ( #60072 经过 @jackbayliss ) - Guzzle PSR-7 multipart fix
— Nested multipart array expansion now relies on
guzzlehttp/psr7to fix a serialization issue ( #59984 经过 @RomainMazB ) - Generic paginate return types
—
Builderpaginate methods now have generic return types for better IDE support ( #60045 经过 @levikl ) - Lottery reset on teardown
—
Lotteryis now reset during test case teardown to prevent test bleed ( #60083 经过 @cosmastech ) - AWS credential provider fix — Custom AWS credential providers now work correctly with the queue driver ( #60000 经过 @iWader )
- Unicode regex fixes
— Unicode modifiers added to
preg_split和SeeInHtmlwhitespace normalization ( #60056 , #60090 )
参考







