Yii Database 2.0 + Drivers

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 ColumnInterface classes according to the data type of database table columns
    for type casting performance
  • ConnectionProvider for connection management
  • ColumnBuilder for column creation
  • CaseX expression for CASE-WHEN-THEN-ELSE statements
  • New conditions: All, None, ArrayOverlaps, JsonOverlaps
  • PHP backed enums support
  • User-defined type casting
  • ServerInfoInterface and 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.