PHPackages                             vincentts/wp-models - 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. vincentts/wp-models

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

vincentts/wp-models
===================

Wrapper models around WP\_Query

0.2(2y ago)142MITPHPPHP ^8.0

Since Feb 5Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)DependenciesVersions (5)Used By (0)

WP Models
---------

[](#wp-models)

Wrapper class around WP Query to create models.

### Installations

[](#installations)

Install the package through composer by running `composer require "vincentts/wp-models"`.

### Getting Started

[](#getting-started)

Define model classes by extending `PostModel` or `TermModel`.

**Post Model**

```
namespace Models;

use Vincentts\WpModels\PostModel;

class Post extends PostModel {

    protected $post_type = 'post';

}
```

**Term Model**

```
namespace Models;

use Vincentts\WpModels\TermModel;

class Category extends TermModel {

    protected $taxonomy = 'category';

}
```

### Defining relationships

[](#defining-relationships)

```
namespace Models;

use Vincentts\WpModels\PostModel;
use Models\Category;

class Post extends PostModel {

    protected $post_type = 'post';

    public function categories() {
        return $this->has( Category::class );
    }

}
```

### Usage

[](#usage)

**Getting posts with relationships**

```
use Models\Post;

$posts = (new Post())->with(['categories'])->get();
```

**Including meta data**

> **Note** ACF `get_field` will be used if it exists. Otherwise it will use `get_post_meta`.

```
use Models\Post;

$posts = (new Post())->meta(['summary', 'description'])->with(['categories'])->get();
```

There are also other methods similar to the arguments from `WP_Query`.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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 ~36 days

Total

4

Last Release

1089d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e80348ee7f47c7fb362565227c64fbfb3d4aa35e0a9ccb011c72b7ac433185e2?d=identicon)[vincentts](/maintainers/vincentts)

---

Top Contributors

[![vincentts](https://avatars.githubusercontent.com/u/18122029?v=4)](https://github.com/vincentts "vincentts (5 commits)")

### Embed Badge

![Health badge](/badges/vincentts-wp-models/health.svg)

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

###  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)
