Laravel 9 已经发布
Laravel 9 发布了,包含许多新的特性: 如PHP 8.0 最低版本支持, 控制器路由分组,全新的默认Ignition异常页面,Laravel Scout 数据库引擎, Symfony Mailer集成,Flyssystem 3.x, 改进的 Eloquent 属性访问器/属性修改器, 及其他特性。
在了解新特性前,需要指出的是,从Laravel 9 开始, Laravel 将每12个月发布一个新的主要版本更新,之前是每6个月发布一次:
Laravel uses a variety of community-driven packages as well as nine Symfony components for a number of features within the framework. Symfony 6.0 is due for release in November. For that reason, we are choosing to delay the Laravel 9.0 release until 2022.
By delaying the release, we can upgrade our underlying Symfony components to Symfony 6.0 without being forced to wait until September 2022 to perform this upgrade. In addition, this better positions us for future releases as our yearly releases will always take place two months after Symfony’s releases.
以下是暂定的将来发布日期:
Version | PHP (*) | Release | Bug Fixes Until | Security Fixes Until |
---|---|---|---|---|
6 (LTS) | 7.2 - 8.0 | September 3rd, 2019 | January 25th, 2022 | September 6th, 2022 |
7 | 7.2 - 8.0 | March 3rd, 2020 | October 6th, 2020 | March 3rd, 2021 |
8 | 7.3 - 8.1 | September 8th, 2020 | July 26th, 2022 | January 24th, 2023 |
9 (LTS) | 8.0 - 8.1 | February 8th, 2022 | February 8th, 2024 | February 8th, 2025 |
10 | 8.0 - 8.1 | February 7th, 2023 | August 7th, 2024 | February 7th, 2025 |
Laravel 9 是下一个长期支持版本 (LTS),在 2024 年 2 月之前都会接收错误修复,在 2025 年 2 月之前则是安全修复。以下是一些Laravel 9的主要特性:
- PHP 8 是 Laravel 9 的最小斑斑支持
- 全新设计的 routes:list
- 新的测试选项 --coverage ,在终端直接显示覆盖率
- 匿名模板迁移现在是默认设置
- 新的查询器接口 Query Builder Interface
- PHP 8 字符串函数
- 邮件功能由SwiftMailer 转到 Symfony Mailer
- Flysystem 3.x
- 改进的 Eloquent 访问器/修改器
- 使用Enums进行隐式路由绑定 (PHP 8.1)
- 控制器路由分组
- 枚举Eloquent属性造型
- 强制范围绑定
- Laravel Breeze API & Next.js
- Laravel Scout 数据库引擎
- 全文索引 / Where Clauses
- Blade 模板行内渲染
- Soketi Echo 服务器
- 可选的 Bootstrap 5 分页视图
- 改进的 Ignition 异常页面
- 新的辅助函数 str() 和 to_route()