PHPackages                             hollisho/wp-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. hollisho/wp-orm

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

hollisho/wp-orm
===============

Eloquent-like ORM for WordPress with read-write splitting and multisite support

v1.0.0(4mo ago)0651MITPHPPHP &gt;=7.4

Since Nov 17Pushed 3mo agoCompare

[ Source](https://github.com/hollisho/wp-orm)[ Packagist](https://packagist.org/packages/hollisho/wp-orm)[ RSS](/packages/hollisho-wp-orm/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (1)

WP-ORM
======

[](#wp-orm)

Eloquent-like ORM for WordPress with advanced features.

Features
--------

[](#features)

- 🔗 **Fluent Query Builder** - Chain methods for elegant queries
- 📖 **Read-Write Splitting** - Separate read and write database connections
- 🌐 **Multisite Support** - Automatic table prefix handling for WordPress multisite
- 🔄 **Relationships** - HasOne, HasMany, BelongsTo, ManyToMany
- 📦 **Collections** - Powerful collection methods
- 🎯 **Model Events** - Hooks for creating, updating, deleting
- 🔍 **Scopes** - Reusable query constraints

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

[](#installation)

```
composer require hollisho/wp-orm
```

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

[](#quick-start)

```
use WPOrm\Model\Model;

class Post extends Model
{
    protected static string $table = 'posts';

    public function author()
    {
        return $this->belongsTo(User::class, 'post_author');
    }
}

// Query
$posts = Post::where('post_status', 'publish')
    ->orderBy('post_date', 'desc')
    ->limit(10)
    ->get();

// Find by ID
$post = Post::find(1);

// Relationships
$author = $post->author;
```

Configuration
-------------

[](#configuration)

### Basic Setup

[](#basic-setup)

```
use WPOrm\Database\ConnectionManager;

ConnectionManager::configure([
    'default' => 'mysql',
    'connections' => [
        'mysql' => [
            'driver' => 'mysql',
            'host' => DB_HOST,
            'database' => DB_NAME,
            'username' => DB_USER,
            'password' => DB_PASSWORD,
            'charset' => DB_CHARSET,
            'prefix' => $GLOBALS['wpdb']->prefix,
        ]
    ]
]);
```

### Read-Write Splitting

[](#read-write-splitting)

```
ConnectionManager::configure([
    'default' => 'mysql',
    'connections' => [
        'mysql' => [
            'read' => [
                'host' => '192.168.1.2',
            ],
            'write' => [
                'host' => '192.168.1.1',
            ],
            'driver' => 'mysql',
            'database' => DB_NAME,
            'username' => DB_USER,
            'password' => DB_PASSWORD,
            'charset' => DB_CHARSET,
            'prefix' => $GLOBALS['wpdb']->prefix,
        ]
    ]
]);
```

### Multisite Support

[](#multisite-support)

```
// Automatically uses the correct table prefix for the current site
$posts = Post::onSite(2)->where('post_status', 'publish')->get();

// Or use global tables
$users = User::global()->get();
```

License
-------

[](#license)

MIT

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance79

Regular maintenance activity

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~50 days

Total

2

Last Release

131d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e8e63d951619620f1fabe34874623212834045e7ce9b77da8e47769c6e3d7a4?d=identicon)[hollisho](/maintainers/hollisho)

---

Top Contributors

[![hollisho](https://avatars.githubusercontent.com/u/13307208?v=4)](https://github.com/hollisho "hollisho (23 commits)")

### Embed Badge

![Health badge](/badges/hollisho-wp-orm/health.svg)

```
[![Health](https://phpackages.com/badges/hollisho-wp-orm/health.svg)](https://phpackages.com/packages/hollisho-wp-orm)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
