PHPackages                             wp-yaml/wp-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. wp-yaml/wp-yaml

ActiveWordpress-muplugin[Utility &amp; Helpers](/categories/utility)

wp-yaml/wp-yaml
===============

Yaml resource registration for WordPress

1.2(4y ago)014GPL-2.0+PHP

Since Dec 22Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ncbateman/wp-yaml)[ Packagist](https://packagist.org/packages/wp-yaml/wp-yaml)[ Docs](http://wp-yaml.com)[ RSS](/packages/wp-yaml-wp-yaml/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (0)

wp-yaml
=======

[](#wp-yaml)

Introduction
------------

[](#introduction)

wp-yaml is a plugin to facilitate registration of WordPress resources within plugins and themes, using YAML.

Plugin / theme registration.
----------------------------

[](#plugin--theme-registration)

**For a working example see: [wp-yaml-example-plugin](https://github.com/ncbateman/wp-yaml-example-plugin)**

To register a plugin or theme with wp-yaml, the wp-yaml plugin must be installed and activated.

The theme / plugin must contain a configuration directory commonly called 'config' example tree shown below:

```
example-config-dir
├── Actions
│   ├── Action1.yaml
│   └── Action2.yaml
├── Filters
│   ├── Filter1.yaml
│   └── Filter2.yaml
├── PostTypes
│   ├── PostType1.yaml
│   └── PostType2.yaml
└── Routes
    ├── Route1.yaml
    └── Route2.yaml

```

The theme / plugin must contain the following snippet of code:

```
use WpYaml\WpYaml as WpYaml;

add_action('muplugins_loaded', function () {

	$wp_yaml = WpYaml::init();

	$wp_yaml->register('/path/to/plugin/config/directory/');

});

```

Once registered, the wp-yaml plugin with ingest and register all resources defined in the configuration directories.

Registering Actions
-------------------

[](#registering-actions)

Action config files must be structed as follows:

```
---
callback: Full\Callback\Class\Namespace
actions:
    action_a:
      hook: admin_enqueue_scripts
      method: method_name_a
    action_b:
      hook: admin_enqueue_scripts
      method: method_name_b
      priority: 5
      args: 1

```

You may register as many methods per callback as you like, but only one callback class per config file. You may have as many Action config files as you like to utilise multiple callback classes.

The priority and args values are optional as per wordpress.

Registering Filters
-------------------

[](#registering-filters)

Filter config files must be structed as follows:

```
---
callback: Full\Callback\Class\Namespace
filters:
    filter_a:
      hook: admin_enqueue_scripts
      method: method_name_a
      priority: 5
      args: 1
    filter_b:
      hook: admin_enqueue_scripts
      method: method_name_b

```

As with actions, you may register as many methods per callback as you like, but only one callback class per config file. You may have as many Filter config files as you like to utilise multiple callback classes.

The priority and args values are optional as per wordpress.

Registering Routes
------------------

[](#registering-routes)

Routes have a very light config file as most of the work is done by the route class which should be an extension of *WP\_REST\_Controller*.

Route config files must be structured as follows:

```
---
routes:
  route_a: Full\WP_REST_Controller\Class\NamespaceA
  route_b: Full\WP_REST_Controller\Class\NamespaceB

```

Registering PostTypes
---------------------

[](#registering-posttypes)

Post Types are entirely defined in the config file and use no callback class.

Post Type config files must be structured as follows:

```
---
example-posttype:
  labels:
    name: Example Post Types
    singular_name: Example Post Type
    menu_name: Example Post Types
    name_admin_bar: Example Post Types
    add_new: Add New
    add_new_item: Add New Example Post Type
    edit_item: Edit Example Post Type
    new_item: New Example Post Type
    view_item: View Example Post Type
    search_items: Search Example Post Types
    not_found: No Example Post Types found
    not_found_in_trash: No Example Post Types found in trash
    all_items: All Example Post Types
    parent_item: Parent Example Post Type
    parent_item_colon: 'Parent Example Post Type:'
    archive_title: Example Post Types
  description: Example Post Type Description
  public: true
  publicly_queryable: true
  exclude_from_search: false
  show_in_nav_menus: false
  show_ui: true
  show_in_menu: true
  show_in_admin_bar: true
  menu_position:
  menu_icon: dashicons-admin-site
  can_export: true
  delete_with_user: false
  hierarchical: false
  has_archive: example_post_type
  query_var: example_post_type
  capability_type: page
  map_meta_cap: true
  rewrite:
    slug: example-posttype
    with_front: false
    pages: true
    feeds: true
    ep_mask: 1
  supports:
  - custom-fields
  - revisions
  - title

```

You may have as many post types per config file as you like, however, for simplicity of organisation 1 per file feels best.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 96.3% 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 ~527 days

Total

3

Last Release

1646d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bcc89448293f1a1830246404cf12dfbbf06391818512ca0d6d54938ee630821f?d=identicon)[ncbateman](/maintainers/ncbateman)

---

Top Contributors

[![ncbateman](https://avatars.githubusercontent.com/u/7091346?v=4)](https://github.com/ncbateman "ncbateman (26 commits)")[![barryparkin](https://avatars.githubusercontent.com/u/1405650?v=4)](https://github.com/barryparkin "barryparkin (1 commits)")

### Embed Badge

![Health badge](/badges/wp-yaml-wp-yaml/health.svg)

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

###  Alternatives

[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[drupal/console-extend-plugin

Drupal Console Extend Plugin

13214.3M5](/packages/drupal-console-extend-plugin)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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