PHPackages                             keironlowe/posty - 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. keironlowe/posty

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

keironlowe/posty
================

Object orientated WordPress post type manager

1.1.0(5y ago)22271[2 issues](https://github.com/KeironLowe/posty/issues)MITPHPPHP &gt;=7.4

Since Aug 10Pushed 5y ago1 watchersCompare

[ Source](https://github.com/KeironLowe/posty)[ Packagist](https://packagist.org/packages/keironlowe/posty)[ RSS](/packages/keironlowe-posty/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (5)Versions (8)Used By (0)

Posty
=====

[](#posty)

Posty is an object orientated post type manager for WordPress. It makes it a breeze to manage your post types and any custom columns.

Roadmap
-------

[](#roadmap)

- Post Type
- Columns
- Sortable Columns
- Statuses
- Tags/Taxonomies

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

[](#installation)

Posty has no dependencies, and requires PHP &gt;= 7.4.

```
composer require keironlowe/posty

```

Usage
-----

[](#usage)

Posty provides a fluent API for managing both your post types and columns. To get started, just use the `make` method, providing the singular and plural names, to create a new post type. It's important to note that **the register method must always be called last**. Any changes made after the `register` method won't take effect.

```
Posty\Posty::make('Product', 'Products')->register();
```

This post type slug/ID will be automatically generated based on the singular name, so in this case it would be `product`. Optionally, you can pass a third argument to define this yourself.

### Setting labels and arguments

[](#setting-labels-and-arguments)

Posty handles setting up all the labels, along with some sensible default arguments, but we know that one size doesn't fit all, so you can update these using the `setLabels` and `setArguments` methods.

```
Posty\Posty::make('Product', 'Products')
    ->setLabels()
    ->setArguments()
    ->register();
```

Both `setLabels` and `setArguments` should receive an array, this can either by passed directly, or as a result of a callback function.

```
Posty\Posty::make('Product', 'Products')
    ->setLabels([
        // All labels
    ])
    ->register();
```

```
Posty\Posty::make('Product', 'Products')
    ->setLabels(function ($labels) {
        $labels['menu_name'] = 'Overwrite value'

        return $labels;
    })
    ->register();
```

### Columns

[](#columns)

To manage the columns, we first need to grab the `ColumnRepository` instance using the `columns` method. This class has the `add`, `remove` and `reorder` methods. Each of these methods should receive an array, this can either by passed directly, or as a result of a callback function.

```
$products = Posty\Posty::make('Product', 'Products');
$columns  = $products->columns();
```

#### Adding Columns

[](#adding-columns)

The `add` method should receive an array of columns. Each column should be an array of key =&gt; value pairs, with two required elements, `label` and `value`

The `label` is the label for the column, and the `value` should be a function which takes the ID of the post, and returns the correct value. Optionally, there is also the `order` element, which should be an integer and allows you to reorder the column.

The ID of the field is automatically generated from the label, but in the case you need to manually set this, you can use the `id` element.

You can make the column sortable by setting the `sort` element to either `alpha` or `numeric`.

```
$columns->add([
    [
        'label' => 'Price'
        'value' => fn (int $post_id) => get_field('price', $post_id)
        'order' => 2,
        'sort'  => 'numeric'
    ],
    [
        'label' => 'Image'
        'value' => fn (int $post_id) => get_field('image', $post_id)
        'order' => 3,
        'id'    => 'alternate_image',
        'sort'  => 'alpha'
    ]
]);

$columns->add(function (array $existingColumns) {
    // Return column array
});
```

#### Removing Columns

[](#removing-columns)

The `remove` method should receive an array of column IDs to be removed. By default, custom post types have `cb` (checkbox), `title`, `author` and `date` columns which you can remove if neccessary.

```
$columns->remove(['author', 'date']);
```

#### Reordering Columns

[](#reordering-columns)

The `reorder` method should receive an array of column IDs in the order that you wish. By default, custom post types have `cb` (checkbox), `title`, `author` and `date` columns which you should bear in mind when reordering. Any columns that aren't included in the array will be added at the end.

```
$columns->reorder(['cb', 'title', 'price', 'image']);
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Total

6

Last Release

2145d ago

Major Versions

1.1.0 → v2.x-dev2020-08-18

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47122923?v=4)[KeironLowe](/maintainers/KeironLowe)[@KeironLowe](https://github.com/KeironLowe)

---

Top Contributors

[![KeironLowe](https://avatars.githubusercontent.com/u/47122923?v=4)](https://github.com/KeironLowe "KeironLowe (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/keironlowe-posty/health.svg)

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

PHPackages © 2026

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