PHPackages                             vendi-advertising/vendi-cpt-from-yaml - 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. vendi-advertising/vendi-cpt-from-yaml

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

vendi-advertising/vendi-cpt-from-yaml
=====================================

Loads CPTs from a yaml file

v2.0.6(1y ago)2314MITPHPPHP ^8.0|^8.1|^8.2|^8.3|^8.4CI passing

Since Jul 24Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vendi-advertising/vendi-cpt-from-yaml)[ Packagist](https://packagist.org/packages/vendi-advertising/vendi-cpt-from-yaml)[ RSS](/packages/vendi-advertising-vendi-cpt-from-yaml/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (13)Used By (0)

Custom Post Types (CPTs)
========================

[](#custom-post-types-cpts)

[![PHP Composer](https://github.com/vendi-advertising/vendi-cpt-from-yaml/actions/workflows/php.yml/badge.svg)](https://github.com/vendi-advertising/vendi-cpt-from-yaml/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/5c09a50f93f0fc5fbd9f6a5ca370a85e07c8ecf097665b4cdf6f61fda0676d0d/68747470733a2f2f636f6465636f762e696f2f67682f76656e64692d6164766572746973696e672f76656e64692d6370742d66726f6d2d79616d6c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/vendi-advertising/vendi-cpt-from-yaml)

Vendi stores CPT information in [YAML](https://yaml.org/) files and uses this library for parsing and loading CPTs. Although there is a very slight overhead in doing this, the front-end caching will offset this completely. For sites that don't have a front-end cache, the YAML file could be additionally parsed and stored in a transient.

Location and File Name
----------------------

[](#location-and-file-name)

The config file is generally stored in a folder off of the theme's root called `.config` with a name of `cpts.yaml`. You may also create an environment variable called `CPT_YAML_FILE` that points either to the absolute path of the config file, or a path relative to the theme's directory.

Options
-------

[](#options)

The file format is very simple and is intended for the 99% use case for CPTs. There are no features in the YAML file that aren't available to the traditional `register_post_type` WordPress function.

- The root key is the WordPress slug for the CPT
    - Because this is the slug, just like any other CPT, you should never change this once you've defined it or else your existing content might get lost.
- The two required child keys are `singular` and `plural` which control the display name for the CPT.
- Two optional child keys are `singular_lowercase` and `plural_lowercase`however if they are not present they will be generated automatically.
- The last optional child key is `extended_options` whose values map directly to the core WordPress function [register\_post\_type](https://developer.wordpress.org/reference/functions/register_post_type/)

Sample
------

[](#sample)

```
# The slug for our alert CPTs
alert:
    # Singular and plural human-readable versions
    singular: Alert
    plural: Alerts

    # The contents of this key are merged with the required WordPress labels and passed directly
    # as the second argument to the register_post_type function. Common default values for these
    # items are set in https://github.com/vendi-advertising/vendi-cpt-from-yaml/blob/f85a3db005da11f88b9e5340ba12202b86584f81/src/CPTBase.php#L160
    extended_options:
        supports:
            - title
            - editor
        public: true
        has_archive: false
        menu_icon: dashicons-visibility
        exclude_from_search: true
        publicly_queryable: false
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance49

Moderate activity, may be stable

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 97.6% 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 ~191 days

Recently: every ~301 days

Total

12

Last Release

376d ago

Major Versions

v1.1.1 → v2.0.02021-11-01

PHP version history (5 changes)v1.0.3PHP ^7.3

v1.1.1PHP ^7.3|^8.0

v2.0.4PHP 8.0.\*|8.1.\*|8.2.\*

v2.0.5PHP ^8.0|^8.1|^8.2

v2.0.6PHP ^8.0|^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7748460?v=4)[Chris Haas](/maintainers/cjhaas)[@cjhaas](https://github.com/cjhaas)

---

Top Contributors

[![cjhaas](https://avatars.githubusercontent.com/u/7748460?v=4)](https://github.com/cjhaas "cjhaas (41 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vendi-advertising-vendi-cpt-from-yaml/health.svg)

```
[![Health](https://phpackages.com/badges/vendi-advertising-vendi-cpt-from-yaml/health.svg)](https://phpackages.com/packages/vendi-advertising-vendi-cpt-from-yaml)
```

###  Alternatives

[zhuqipeng/laravel-hprose

Hprose for Laravel

605.8k1](/packages/zhuqipeng-laravel-hprose)

PHPackages © 2026

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