We're excited to announce Yii Database 2.0, a major release modernizing the database abstraction layer with PHP 8.1+ features, enhanced type safety, and powerful new capabilities. The drivers have been released as well: PostgreSQL, MySQL/MariaDB, MSSQL, Oracle and SQLite.
New Features
- Implement
ColumnInterfaceclasses according to the data type of database table columns
for type casting performance ConnectionProviderfor connection managementColumnBuilderfor column creationCaseXexpression for CASE-WHEN-THEN-ELSE statements- New conditions:
All,None,ArrayOverlaps,JsonOverlaps - PHP backed enums support
- User-defined type casting
ServerInfoInterfaceand its implementation
Enhancements
- Optimized SQL generation and query building
- Improved type safety with psalm annotations
- Method chaining for column classes
- Better exception messages
- Refactored core components for better maintainability
- PHP 8.5 support
There have also been many refactorings and bug fixes. See CHANGELOG.md for more information.
See upgrading instructions with notes about upgrading package in your application to this major version.