PHPackages                             barnythorpe/wp-config-containers - 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. barnythorpe/wp-config-containers

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

barnythorpe/wp-config-containers
================================

A simple package with auto-generated builder and DTO classes for Wordpress Post Types and Taxonomies.

0.3.0(11mo ago)010MITPHPCI passing

Since Apr 16Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/Barny-Thorpe/wp-config-containers)[ Packagist](https://packagist.org/packages/barnythorpe/wp-config-containers)[ RSS](/packages/barnythorpe-wp-config-containers/feed)WikiDiscussions main Synced 1mo ago

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

WP Config Containers
====================

[](#wp-config-containers)

Note

This package has been moved into

A Composer package for WordPress that provides strongly-typed **DTO (Data Transfer Object)** classes and **Builder classes** for various Wordpress configurations such as Post Types and Taxonomies.

This package helps bring structure, clarity, and type safety to WordPress projects by wrapping Post Type and Taxonomy configurations in clean, typed objects with fluent builder interfaces.

---

📖 About
-------

[](#-about)

This package auto-generates **Builder Classes** and in some cases **DTOs** for:

- `WP_Post_Type`
- `WP_Taxonomy`
- `WP_Block_Type`
- Block attributes from

The generators read the DocBlocks of WordPress' native classes and automatically create various classes to help construct the above configurations in a clean and safe manner.

---

📦 Installation
--------------

[](#-installation)

You’ll need Composer installed.

```
composer require barnythorpe/wp-config-containers
```

---

🚀 Usage
-------

[](#-usage)

```
use function Barnythorpe\WpConfigContainers\post_type;

$postType = post_type()
    ->name('my_custom_post')
    ->public(true)
    ->build();

$configArray = $postType->toArray();
```

See the [Tests](/tests) directory for more examples of how to use.

---

🛠️ Contributing &amp; Developer Notes
-------------------------------------

[](#️-contributing--developer-notes)

If you're working on this package or maintaining it in the future, here’s what you need to know:

### The Generator

[](#the-generator)

- **Located in:** `src/WpConfigContainersGenerator/Generator.php`
- **Uses:**
    - `phpDocumentor` to parse DocBlocks and types
    - `Twig` templates to generate DTO and Builder class files
- **Templates:**
    - `src/WpConfigContainersGenerator/templates/dto.twig`
    - `src/WpConfigContainersGenerator/templates/builder.twig`

To run the generator:

```
php generate.php
```

### How It Works:

[](#how-it-works)

- The Generator reflects on the original WordPress classes (`WP_Post_Type`, `WP_Taxonomy`).
- It parses each property’s `@var` annotation to determine type and description.
- Uses `Twig` or `nette/php-generator` to generate builder classes with fluent methods for setting those properties
- Generated files are written to the `src` directory.

---

Testing
-------

[](#testing)

We use **PestPHP** for testing.
Tests are located in:

```
/tests/

```

Fixtures and test doubles are in:

```
/tests/Fixtures/

```

Run tests with:

```
./vendor/bin/pest
```

or

```
composer test
```

---

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance52

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity29

Early-stage or recently created project

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

Total

3

Last Release

356d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7a6b3057482ba84ac7b0b84218f21eef79a5519dac9525a4ecdfd8745819930a?d=identicon)[barnythorpe](/maintainers/barnythorpe)

---

Top Contributors

[![Barny-Thorpe](https://avatars.githubusercontent.com/u/47748897?v=4)](https://github.com/Barny-Thorpe "Barny-Thorpe (40 commits)")

---

Tags

composercomposer-packageconfigurationphp

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/barnythorpe-wp-config-containers/health.svg)

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

###  Alternatives

[yonas/directory-hash-php

A standard algorithm to compute the hash of a directory and all it's files.

112.0k](/packages/yonas-directory-hash-php)

PHPackages © 2026

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