Skip to content

v2.0.0

Latest

Choose a tag to compare

@tareq1988 tareq1988 released this 14 Mar 05:08

What's New

Eloquent-inspired ORM for WordPress

  • Model — Abstract base with configurable hook prefix, attribute accessors/mutators, casting, dirty tracking, CRUD operations, and hydration
  • QueryBuilder — Fluent SQL builder with WHERE (basic, in, notIn, null, notNull, between, raw, or), ORDER BY, LIMIT/OFFSET, aggregates (sum, avg, max, min), pagination, and bulk operations
  • Collection — Typed collection implementing Countable, IteratorAggregate, ArrayAccess, and JsonSerializable
  • Model Traits — SoftDeletes, HasTimestamps, HasHash
  • Helper functions — wputils_class_uses_recursive(), wputils_trait_uses_recursive()

Trait Improvements (Breaking)

  • Renamed: ContainerTrait → Container, HookTrait → Hooks, LogTrait → Logger, SingletonTrait → Singleton
  • Container — Added __isset() and __unset() support
  • Singleton — Fixed shared instance bug; now uses per-class instance isolation
  • Logger — Added context data parameter, class name in output, log_warning(), and WP_DEBUG gate for debug messages

Tooling

  • PHPStan level 6 with szepeviktor/phpstan-wordpress
  • PHPUnit 9.6 with Brain\Monkey + Mockery (209 tests, 393 assertions)
  • PHP-CS-Fixer with WordPress coding standards
  • Composer scripts: test, analyse, format, lint

Documentation

  • Full ORM documentation in docs/models.md
  • Updated README with ORM examples

Breaking Changes

  • Traits renamed — update use statements:
    • ContainerTrait → Container
    • HookTrait → Hooks
    • LogTrait → Logger
    • SingletonTrait → Singleton
  • Minimum PHP version: 7.4