PHPackages                             quentingab/wodel - 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. quentingab/wodel

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

quentingab/wodel
================

WordPress Post Model

v2.1(4y ago)029MITPHPPHP ^7.4|^8.0

Since Jul 14Pushed 4y agoCompare

[ Source](https://github.com/QuentinGab/Wodel)[ Packagist](https://packagist.org/packages/quentingab/wodel)[ Docs](https://github.com/quentingab/wodel)[ RSS](/packages/quentingab-wodel/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (21)Used By (0)

wodel
=====

[](#wodel)

Easy way to interact with WordPress database, query, insert and update posts. And it also works with ACF.

[![Latest Version on Packagist](https://camo.githubusercontent.com/1a008d77f0ff2efa35719d8845a9514650e43620e18a82713acbcba58743bf0c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7175656e74696e6761622f776f64656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/quentingab/wodel)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/ea5dd3cd98a833501c8a5b22651b0db36d1487d44cef443b49708e5ad511e4d9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7175656e74696e6761622f776f64656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/quentingab/wodel)

Install
-------

[](#install)

Via Composer

```
$ composer require quentingab/wodel
```

Usage with WordPress posts
--------------------------

[](#usage-with-wordpress-posts)

### Get all posts/page and custom post type

[](#get-all-postspage-and-custom-post-type)

```
$posts = QuentinGgab\Models\Wodel::all();
foreach($posts as $post){
    echo $post->post_title;
}
```

### Get current post with acf

[](#get-current-post-with-acf)

```
$post = QuentinGab\Models\Wodel::current();
```

### Update a post

[](#update-a-post)

```
$post = QuentinGab\Models\Wodel::current();
$post->post_title = "Hello World";
$post->save();
```

### Insert a post

[](#insert-a-post)

```
$post = new QuentinGab\Models\Wodel(
    [
    'post_title'=>'Hello World'
    ]
);
$post->save();
```

Extend the Wodel
----------------

[](#extend-the-wodel)

```
class Page extends QuentinGab\Wodel\Models\Wodel
{
    protected $post_type = 'page';

    //only necessary if you want to insert a new post programmatically
    //otherwise the acf fields will not be populated
    //If you only get Model or update existing Model you can omit $acf_keys
    protected $acf_keys = [
        'the_field_name' => 'the_field_key',
        'color' => 'field_5f7848684c404',
    ];
}

$page = Page::find(1);
echo $page->color;
```

Usage with custom table
-----------------------

[](#usage-with-custom-table)

if you have data stored in a custom table you can use QuentinGab\\Models\\Model to interact with the database. Under the hood it only use default WordPress object $wpdb.

### Example of a custom table

[](#example-of-a-custom-table)

```
global $wpdb;

$table_name = 'events';
$charset_collate = $wpdb->get_charset_collate();

$sql = "CREATE TABLE $table_name (
    id bigint(20) NOT NULL AUTO_INCREMENT,
    title varchar(255),
    active boolean DEFAULT 0 NOT NULL,
    created_at datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
    PRIMARY KEY  (id)
) $charset_collate;";

dbDelta($sql);
```

### Create a Model class

[](#create-a-model-class)

```
class Event extends QuentinGab\Wodel\Models\Model
{
    protected $table = 'events';

    protected $primary_key = "id";

    protected $fillable = [
        'title'
    ];

    protected $casts = [
        'active' => 'bool',
    ];
}
```

### Get Model

[](#get-model)

```
$all = Event::all();
$only_active = Event::where(['active'=>true]);
$with_primary_key_1 = Event::find(1);
```

### Save Model

[](#save-model)

```
$new_event = new Event(['title'=>'my new event','active'=>false]);
$new_event->save();
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [quentin gabriele](https://github.com/QuentinGab)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity70

Established project with proven stability

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

Recently: every ~36 days

Total

20

Last Release

1820d ago

Major Versions

v0.3.0 → v1.02021-02-12

v1.0.5 → v2.02021-07-07

PHP version history (2 changes)v0.1PHP ~7.2

v2.0PHP ^7.4|^8.0

### Community

Maintainers

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

---

Top Contributors

[![QuentinGab](https://avatars.githubusercontent.com/u/40128136?v=4)](https://github.com/QuentinGab "QuentinGab (63 commits)")

---

Tags

eloquentmodelmodelswordpresswordpress-developmentquentingabwodel

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/quentingab-wodel/health.svg)

```
[![Health](https://phpackages.com/badges/quentingab-wodel/health.svg)](https://phpackages.com/packages/quentingab-wodel)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.5k](/packages/illuminate-database)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M94](/packages/mongodb-laravel-mongodb)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)[laravel-liberu/laravel-gedcom

A package that converts gedcom files to Eloquent models

782.5k1](/packages/laravel-liberu-laravel-gedcom)

PHPackages © 2026

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