PHPackages                             shravanjbp/flexi-orm - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. shravanjbp/flexi-orm

ActiveLibrary[Database &amp; ORM](/categories/database)

shravanjbp/flexi-orm
====================

Lightweight Active Record ORM for WordPress and PHP

1.0.1(1mo ago)33GPL-3.0-or-laterPHPPHP &gt;=8.1

Since Feb 6Pushed 1mo agoCompare

[ Source](https://github.com/shravanjbp/flexi-orm)[ Packagist](https://packagist.org/packages/shravanjbp/flexi-orm)[ Docs](https://github.com/shravanjbp/flexi-orm)[ RSS](/packages/shravanjbp-flexi-orm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (0)

Flexi ORM
=========

[](#flexi-orm)

A lightweight, production-ready Active Record ORM for WordPress. Provides a clean, expressive API for database operations without direct SQL.

**Requires**: PHP 8.1+, WordPress with $wpdb available

Features
--------

[](#features)

- ✅ **Active Record Pattern** - Models representing database tables
- ✅ **Type-Safe** - Full PHPDoc and type hints for IDE support
- ✅ **Relationships** - HasMany, HasOne, BelongsTo, ModuleMany (polymorphic)
- ✅ **Eager Loading** - Prevent N+1 queries with relation loading
- ✅ **Fluent Query Builder** - Expressive method chaining
- ✅ **Dirty Tracking** - Track changed attributes before saving
- ✅ **Mass Assignment Protection** - Fillable/guarded configuration
- ✅ **Attribute Casting** - Automatic JSON, datetime, money conversions
- ✅ **Serialization** - Hidden/visible attributes for API responses
- ✅ **Pagination** - Offset-based pagination for REST APIs
- ✅ **Comprehensive Documentation** - Over 200 PHPDoc comments

Installation
------------

[](#installation)

```
composer require shravanjbp/flexi-orm
```

Quick Start
-----------

[](#quick-start)

### Basic Model Definition

[](#basic-model-definition)

```
