编程

Laravel 10.1发布

649 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');

该代码导致helloworld被传递给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)