PHPackages                             flexpress/component-post-type - 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. flexpress/component-post-type

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

flexpress/component-post-type
=============================

Post type helper for WordPress

v1.0.0(11y ago)0971PHP

Since Aug 13Pushed 11y ago1 watchersCompare

[ Source](https://github.com/FlexPress/component-post-type)[ Packagist](https://packagist.org/packages/flexpress/component-post-type)[ RSS](/packages/flexpress-component-post-type/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (1)

FlexPress PostType component
============================

[](#flexpress-posttype-component)

Install with Pimple
-------------------

[](#install-with-pimple)

The PostType component uses two classes:

- AbstractPostType, which you extend to create a PostType.
- PostTypeHelper, which hooks into everything for you and registers the post types.

Lets create a pimple config for both of these

```
$pimple["documentPostType"] = function () {
  return new Document();
};

$pimple['PostTypeHelper'] = function ($c) {
    return new PostTypeHelper($c['objectStorage'], array(
        $c["documentPostType"]
    ));
};

```

- Note the dependency $c\['objectStorage'\] is a SPLObjectStorage

Creating a concreate PostType class
-----------------------------------

[](#creating-a-concreate-posttype-class)

Create a concreate class that implements the AbstractPostType class and implements the getName() method.

```
class DocumentType extends AbstractPostType {

    public function getName()
    {
      return "document";
    }

}

```

This above example is the bare minimum you must implement, the example that follows is the other extreme implementing all available methods.

```
class Document extends AbstractPostType {

  public function getSingularName()
  {
    return "Doc";
  }

  public function getPluralName()
  {
    return "Docs";
  }

  public function getArgs()
  {
    $args = parent::getArgs();
    $args['supports'] = array("title", "editor");
    return $args;
  }

  protected function getLabels()
  {
    $labels = parent::getLabels();
    $labels['menu_name'] = 'Docs';
    return $labels;
  }

  public function getName()
  {
    return "document";
  }

}

```

### Public Methods

[](#public-methods)

- getSingularName() - returns the singular name of the post type.
- getPluralName() - returns the plural name of the post type.
- getArgs() - returns the array of args.
- getLabels() - Returns the array of labels.
- getName() - Returns post type name.

PostTypeHelper usage
--------------------

[](#posttypehelper-usage)

Once you have setup the pimple config you are use the PostTypeHelper like this

```
$helper = $pimple['postTypeHelper'];
$helper->registerPostTypes();

```

That's it, the helper will then add all the needed hooks and register all the post types you have provided it.

### Public methods

[](#public-methods-1)

- registerPostTypes() - Registers the post types provided.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Unknown

Total

1

Last Release

4296d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2b794650fae4ab8d86e8550fa2e0cd8658323e07a8d78b3e96d0bc373bc88d2a?d=identicon)[timperry](/maintainers/timperry)

### Embed Badge

![Health badge](/badges/flexpress-component-post-type/health.svg)

```
[![Health](https://phpackages.com/badges/flexpress-component-post-type/health.svg)](https://phpackages.com/packages/flexpress-component-post-type)
```

PHPackages © 2026

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