Laravel 7.2 发布了,此版本包含 HTTP 客户端查询字符串支持和 SMTP 邮件驱动程序的新超时配置选项。
主要新特性有:
ExpectsConfirmation 测试方法
用于测试 artisan 命令的 PendingCommand 类上的 ExpectsConfirmation() 方法:
$this
->artisan(
'foo:bar'
)
->expectsConfirmation(
'Do you want to continue?'
,
'no'
)
->assertExitCode(
1
);
SMTP 邮件驱动程序超时
SMTP 邮件驱动程序现在有了超时配置。默认值为 30 秒。如果要调整默认值,请以秒数为单位添加自定义超时配置:
'timeout'
=>
60
,
// seconds
支持 HTTP 客户端查询字符串
这意味着可以将第二个参数传递给 Http::get()
这是一个工作原理示例:
Http::get(
'https://example.com/get'
);
// URL: https://example.com/get
Http::get(
'https://example.com/get?abc=123'
);
// URL: https://example.com/get?abc=123
Http::get(
'https://example.com/get'
, [
'foo'
=>
'bar'
]);
// URL: https://example.com/get?foo=bar
Http::get(
'https://example.com/get'
,
'foo=bar'
);
// URL: https://example.com/get?foo=bar
请注意,将查询参数传递给 get() 会覆盖 URI 中的所有内容,因此使用其中一个就好。
更多详情见发布公告:
https://laravel-news.com/laravel-7-2-0