编程

Laravel 10.1 发布

768 2023-02-23 10:45:29

Laravel 团队本周发布了 10.1,其中包含 Process 标准输入,删除了控制器 stub 的返回类型等。

作为主版本之后的典型版本,Laravel 10 标记了多个补丁级别版本,最近的版本是 v10.1.0。以下是最新的 Laravel 10 版本中的最新内容:

标准输入可应用于待定处理

Peter Fox 提供了 Process::input() 方法,该方法允许标准输入通过 input 方法传递给进程:

Process::input('hello world')->run('pbcopy');

该代码导致 hello world 被传递给 pbcopy 命令的标准输入

删除控制器 stub 中的返回类型

Laravel 10 主版本在用户代码中包含返回类型,包括控制器 stub。然而,这造成了一些混乱,因为 Laravel 控制器可以返回各种类型的数据(即数组、字符串、视图等)。

PR#46166 旨在返回 mix 类型,以避免生成的控制器中的错误,但仍然提供类型。最终,PR#46166 被更新以从控制器中删除所有返回类型。如果你想在生成的控制器中使用原生返回类型,有很多选项可让您自定义 stub。

如果你想了解更多关于根据你的偏好调整控制器 stub 的信息,请参阅在 Laravel 中自定义 Stub。

在 Monitor 命令中显示队列连接

Gustavo Sobrinho 将队列连接加入到 artisan queue:monitor 命令中。此更改允许具有多个队列连接的用户在同一命令中显示多个连接:

php artisan queue:monitor redis:events,database:events

Release Notes

You can see the complete list of new features and updates below and the diff between 10.0.0 and 10.1.1 on GitHub. The following release notes are directly from the changelog:

v10.1.1

Added

  • Add the ability to re-resolve cache drivers (#46203)

Fixed

  • Fixed Illuminate/Collections/Arr::shuffle() for empty array (0c6cae0)

v10.1.0

Fixed

  • Fixing issue where 0 is discarded as a valid timestamp (#46158)
  • Fix custom themes not reseting on Markdown renderer (#46200)

Changed

  • Use secure randomness in Arr:random and Arr:shuffle (#46105)
  • Use mixed return type on controller stubs (#46166)
  • Use InteractsWithDictionary in Eloquent collection (#46196)

v10.0.3

Added

  • Added missing expression support for pluck in Builder (#46146)

v10.0.2

Added

  • Register policies automatically to the gate (#46132)

v10.0.1

Added

  • Standard Input can be applied to PendingProcess (#46119)

Fixed

  • Fix Expression string casting (#46137)

Changed

  • Add AddQueuedCookiesToResponse to middlewarePriority so it is handled in the right place (#46130)
  • Show queue connection in MonitorCommand (#46122)