Skip to content

v2.9.3

Choose a tag to compare

@tommyknocker tommyknocker released this 09 Nov 06:19
· 314 commits to master since this release

Release v2.9.3

🎉 Major feature release with Regular Expression Helpers, Plugin System, Advanced DML Operations, and significant documentation improvements!

🚀 New Features

Regular Expression Helpers

  • Cross-database regex support with unified API (Db::regexpMatch(), Db::regexpReplace(), Db::regexpExtract())
  • Automatic SQLite registration via PDO::sqliteCreateFunction() if REGEXP extension is not available
  • Configuration option enable_regexp for SQLite (default: true)
  • Full support across MySQL, MariaDB, PostgreSQL, and SQLite

JSON Modification Helpers

  • Db::jsonSet() - Set JSON values at specific paths (supports nested paths)
  • Db::jsonRemove() - Remove JSON keys or array elements
  • Db::jsonReplace() - Replace existing JSON values
  • Proper MariaDB compatibility handling

Plugin System

  • AbstractPlugin class for extending PdoDb functionality
  • PdoDb::registerPlugin() method
  • Support for registering macros, scopes, and event listeners
  • Complete documentation and examples

Advanced DML Operations

  • JOIN Support for UPDATE and DELETE - Update/delete tables based on JOIN conditions
  • INSERT ... SELECT - Bulk insert from query results via QueryBuilder::insertFrom()
  • Cross-dialect support for all operations

Transaction Management

  • Savepoints and Nested Transactions - Advanced transaction control
  • Rollback to specific savepoints without affecting outer transactions

SQLite Enhancements

  • DEFAULT Helper Support - Db::default() now works on SQLite (auto-converted to NULL)
  • String Function Emulation - REPEAT(), REVERSE(), LPAD(), RPAD() automatically registered

Enhanced EXPLAIN Analysis

  • Additional performance metrics
  • Improved query optimization suggestions
  • Enhanced parsing for all dialects

📝 Documentation Improvements

  • Major README overhaul:
    • Reorganized feature list into logical categories
    • Added "Why PDOdb?" section with value proposition
    • Added "5-Minute Tutorial" for quick onboarding
    • Added FAQ section (10 common questions)
    • Added Migration Guide (Raw PDO, Eloquent, Doctrine, Yii2)
    • Simplified Quick Example (basic CRUD with SQLite)
  • Updated Examples section with current structure
  • Replaced chained where() with andWhere() for better clarity

🔧 Changes

  • Examples Directory Reorganization - Improved structure for better navigation
  • Code Quality Improvements - Namespace refactoring, better code organization, PSR-12 compliance

🐛 Fixes

  • Composer Description - Shortened for better Packagist display

📊 Technical Details

  • All tests passing - Comprehensive test coverage including new regex, JSON, and SQLite emulation tests
  • PHPStan Level 8 - Zero errors across entire codebase
  • PHP-CS-Fixer - All code complies with PSR-12 standards
  • 100% backward compatibility - All existing code continues to work
  • All examples verified - Updated and verified on all dialects (MySQL, MariaDB, PostgreSQL, SQLite)

📚 Documentation & Examples

  • Complete documentation for all new features
  • Comprehensive examples in examples/ directory
  • Plugin development guide
  • Transaction management guide with savepoints

🔗 Links


Installation:

composer require tommyknocker/pdo-database-class:^2.9.3

Upgrade from v2.9.2:
No breaking changes - safe to upgrade! 🎉