PHPackages                             soberwp/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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. soberwp/models

AbandonedArchivedWordpress-muplugin[Parsing &amp; Serialization](/categories/parsing)

soberwp/models
==============

WordPress plugin to create custom post types and taxonomies using JSON, YAML or PHP files.

1.1.0-p(7y ago)17272.4k↓43.8%15[2 issues](https://github.com/soberwp/models/issues)2MITPHPPHP &gt;=5.6

Since Jan 3Pushed 5y ago11 watchersCompare

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

READMEChangelogDependencies (4)Versions (13)Used By (2)

Models
======

[](#models)

Models is a WordPress plugin allowing you to create custom post types and taxonomies using JSON, YAML or PHP files.

**[You can now set post types and taxonomies using Intervention 2.x.x.](https://github.com/soberwp/intervention)**

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

[](#installation)

#### Composer:

[](#composer)

Recommended methods:

[Roots Bedrock](https://roots.io/bedrock/)

```
$ composer require soberwp/models:1.1.0
```

**Models** is a mu-plugin so it doesn't have to be activated.

[Roots Sage](https://roots.io/sage/)

```
$ composer require soberwp/models:1.1.0-p
```

#### Manual:

[](#manual)

- Download the [zip file](https://github.com/soberwp/models/archive/master.zip)
- Unzip to your sites plugin folder
- Activate via WordPress

#### Requirements:

[](#requirements)

- [PHP](http://php.net/manual/en/install.php) &gt;= 5.6.x

Setup
-----

[](#setup)

By default, create folder `models/` within the active theme directory.

If you are a [Roots Sage](https://roots.io/sage/) the default folder is `app/models/`

Alternatively, you can define a custom path using the filter below within your themes `functions.php` file:

```
add_filter('sober/models/path', function () {
    return get_stylesheet_directory() . '/your-custom-folder';
});
```

That's it, now go ahead and add `model-name.json` files, in the folder or subfolders to begin creating your models. Use [Unravel](https://github.com/soberwp/unravel) to automatically move the config files outside of your theme path for better separation of concerns.

Usage
-----

[](#usage)

The data structure follows a similar data structure to WordPress taxonomies and post types arrays, so if an config option is missing from the examples below, follow the developer's reference and place it within `"config": {}`

If values are not specified, defaults are the same as WordPress defaults.

Additionally, if the [Extended CPTs](https://github.com/johnbillion/extended-cpts) library is available, Models will use it when registering your post types and taxonomies instead allowing extended functionality within your Models.

Extracted examples presented below are in JSON format.

### Post Types

[](#post-types)

Create a custom post type.

#### Required:

[](#required)

- [post-type-required.json](.github/json/post-type-required.json)
- [post-type-required.php](.github/php/post-type-required.php)
- [post-type-required.yaml](.github/yaml/post-type-required.yaml)

```
{
  "type": "post-type",
  "name": "book"
}
```

#### Basic:

[](#basic)

- [post-type-basic.json](.github/json/post-type-basic.json)
- [post-type-basic.php](.github/php/post-type-basic.php)
- [post-type-basic.yaml](.github/yaml/post-type-basic.yaml)

```
{
  "type": "cpt",
  "name": "book",
  "supports": [
    "title", "editor", "thumbnail"
  ],
  "labels": {
    "has_one": "Book",
    "has_many": "Books",
    "text_domain": "sage"
  }
}
```

In the above example, `"labels": {}` are redundant because `"Book"` and `"Books"` would have been generated from `"name"`.

#### Multiple:

[](#multiple)

- [post-type-multiple.json](.github/json/post-type-multiple.json)
- [post-type-multiple.php](.github/php/post-type-multiple.php)
- [post-type-multiple.yaml](.github/yaml/post-type-multiple.yaml)

```
[
  {
    "type": "cpt",
    "name": "book",
    "supports": [
      "title", "editor", "thumbnail"
    ]
  },
  {
    "type": "cpt",
    "name": "album",
    "supports": [
      "title", "editor", "comments"
    ]
  }
]
```

#### All Fields:

[](#all-fields)

- [post-type-all.json](.github/json/post-type-all.json)
- [post-type-all.php](.github/php/post-type-all.php)
- [post-type-all.yaml](.github/yaml/post-type-all.yaml)

#### Post Type Tips:

[](#post-type-tips)

- `"active": false` stops the post type from being created. Default is set to `true`.
- `"type": "post-type"` also accepts a shorthand `"type": "cpt"`;

### Taxonomies

[](#taxonomies)

Create a custom taxonomy.

#### Required:

[](#required-1)

- [taxonomy-required.json](.github/json/taxonomy-required.json)
- [taxonomy-required.php](.github/php/taxonomy-required.php)
- [taxonomy-required.yaml](.github/yaml/taxonomy-required.yaml)

```
{
  "type": "taxonomy",
  "name": "genre"
}
```

#### Basic:

[](#basic-1)

- [taxonomy-basic.json](.github/json/taxonomy-basic.json)
- [taxonomy-basic.php](.github/php/taxonomy-basic.php)
- [taxonomy-basic.yaml](.github/yaml/taxonomy-basic.yaml)

```
{
  "type": "tax",
  "name": "genre",
  "links": [
    "post", "book"
  ],
  "labels": {
    "has_one": "Book Genre",
    "has_many": "Book Genres",
    "text_domain": "sage"
  }
}
```

`"links": (string|array)` assigns the taxonomy to post types. Defaults to `"links": "post"`

#### Multiple:

[](#multiple-1)

- [taxonomy-multiple.json](.github/json/taxonomy-multiple.json)
- [taxonomy-multiple.php](.github/php/taxonomy-multiple.php)
- [taxonomy-multiple.yaml](.github/yaml/taxonomy-multiple.yaml)

```
[
  {
    "type": "category",
    "name": "genre",
    "links": "book"
  },
  {
    "type": "tag",
    "name": "author",
    "links": "book"
  }
]
```

`"type": "category"` and `"type": "tag"` shorthands are explained below under Tips.

#### All Fields:

[](#all-fields-1)

- [taxonomy-all.json](.github/json/taxonomy-all.json)
- [taxonomy-all.php](.github/php/taxonomy-all.php)
- [taxonomy-all.yaml](.github/yaml/taxonomy-all.yaml)

#### Taxonomy Tips:

[](#taxonomy-tips)

- `"active": false` stops the taxonomy from being created. Default is set to `true`.
- `"type": "taxonomy"` also accepts shorthands;
    - `"type": "tax"`
    - `"type": "category"` or `"type": "cat"` creates a category taxonomy.
    - `"type": "tag"` creates a tag taxonomy.

Support
-------

[](#support)

- Follow [@withjacoby](https://twitter.com/withjacoby) on Twitter
- Buy me a beer or pay my rent, [paypal.me/darrenjacoby](https://paypal.me/darrenjacoby)

Updates
-------

[](#updates)

#### Composer:

[](#composer-1)

- Change the composer.json version to ^1.0.4\*\*
- Check [CHANGELOG.md](CHANGELOG.md) for any breaking changes before updating.

```
$ composer update
```

#### WordPress:

[](#wordpress)

Includes support for [github-updater](https://github.com/afragen/github-updater) to keep track on updates through the WordPress backend.

- Download [github-updater](https://github.com/afragen/github-updater)
- Clone [github-updater](https://github.com/afragen/github-updater) to your sites plugins/ folder
- Activate via WordPress

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity46

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~88 days

Total

11

Last Release

2834d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.4.0

1.0.6PHP &gt;=5.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d87affcb9a840bfb29e9829079719912cdeb4db040bc5b6a37067416bf91cd6?d=identicon)[darrenjacoby](/maintainers/darrenjacoby)

---

Top Contributors

[![Log1x](https://avatars.githubusercontent.com/u/5745907?v=4)](https://github.com/Log1x "Log1x (2 commits)")[![darrenjacoby](https://avatars.githubusercontent.com/u/15921694?v=4)](https://github.com/darrenjacoby "darrenjacoby (1 commits)")[![dmgawel](https://avatars.githubusercontent.com/u/1322846?v=4)](https://github.com/dmgawel "dmgawel (1 commits)")[![Shwethakpradeep](https://avatars.githubusercontent.com/u/56927359?v=4)](https://github.com/Shwethakpradeep "Shwethakpradeep (1 commits)")

---

Tags

jsonjson-configurationphpwordpresswordpress-pluginyamlwordpress

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[wpreadme2markdown/wpreadme2markdown

Convert WordPress Plugin readme.txt to Markdown

9564.6k4](/packages/wpreadme2markdown-wpreadme2markdown)[wpreadme2markdown/wp2md

CLI tool for converting WordPress Plugin readme.txt to Markdown

1961.7k4](/packages/wpreadme2markdown-wp2md)[freshsystems/wp-acf-markdown-field

Adds a Markdown field to Advanced Custom Fields.

159.2k](/packages/freshsystems-wp-acf-markdown-field)[dudo1985/wpdocgen

Documentation Generator for WordPress.

2327.6k](/packages/dudo1985-wpdocgen)

PHPackages © 2026

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