PHPackages                             hokoo/wppostable - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. hokoo/wppostable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hokoo/wppostable
================

Library provides a functionality for associating your classes with WordPress class WP\_Post.

0.6.2(1y ago)2279[3 issues](https://github.com/hokoo/wpPostAble/issues)MITPHP

Since Aug 21Pushed 1y ago1 watchersCompare

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

READMEChangelog (10)DependenciesVersions (16)Used By (0)

What is wpPostAble
==================

[](#what-is-wppostable)

Library provides a functionality for associating your models with WordPress WP\_Post model. Once you create the instance, wpPostAble creates the WP\_Post object and stores it in your instance.

You can manage your instance with such methods as

- `$instance->getTitle();`
- `$instance->setTitle();`
- `$instance->getMetaField();`
- `$instance->setMetaField();`
- `$instance->getStatus();`
- `$instance->setStatus();`
- `$instance->getPost();`
- `$instance->getPostType();`
- `$instance->savePost();`
- `$instance->loadPost();`
- `$instance->publish();`
- `$instance->draft();`

and others.

Use

- `$instance->getParam();`
- `$instance->setParam();`

method to manage metafields, stored inside `posts` table using `post_content_filtered` field.

How to use
==========

[](#how-to-use)

1. Create your own class based on wpPostAble interface

    ```
    use iTRON\wpPostAble\wpPostAble;
    use iTRON\wpPostAble\wpPostAbleTrait;
    use iTRON\wpPostAble\Exceptions\wppaCreatePostException;
    use iTRON\wpPostAble\Exceptions\wppaLoadPostException;

    class Item implements wpPostAble {
      use wpPostAbleTrait;

      const POST_TYPE = 'item';
    }
    ```
2. Call `wpPostAble()` method in the beginning of the `__construct()` method of your class.

    Pass to it two parameters

    `$post_type` *string* WP post type, associated with your class

    `$post_id` *int* Post ID for existing post, or nothing for creating new post

    ```
       /**
        * @throws Exception\wppaLoadPostException
        * @throws Exception\wppaCreatePostException
        */
       public function __construct( int|null $post_id = null ) {
          $this->wpPostAble( self::POST_TYPE, (int) $post_id );

          // Do anything you need
       }
    ```

Now you are able to use your class
----------------------------------

[](#now-you-are-able-to-use-your-class)

Create new post

```
$item = new Item();
```

or load from existing one

```
$item = new Item( $post_id );
```

Once you create an instance, wpPostAble creates new post in WordPress as a draft.

Let's try change the title

```
$item->setTitle('The best item');
```

Now you have set title, and let's try to save it in database

```
$item->savePost();
```

Maybe it's time to publish?

```
$item->publish();
```

You can do it by single line

```
$item->setTitle('The best item')->publish();
```

More options you can find in the description above and in the source code.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Recently: every ~263 days

Total

11

Last Release

603d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3988fe121d93b3ce7fb819c278cf7f19bf40411db2a1a57bbd4ae6ea4ca3eedc?d=identicon)[hokoo](/maintainers/hokoo)

---

Top Contributors

[![hokoo](https://avatars.githubusercontent.com/u/16269260?v=4)](https://github.com/hokoo "hokoo (46 commits)")

### Embed Badge

![Health badge](/badges/hokoo-wppostable/health.svg)

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

PHPackages © 2026

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