PHPackages                             kaiseki/wp-theme-json - 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. kaiseki/wp-theme-json

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

kaiseki/wp-theme-json
=====================

Type-safe builder for WordPress theme.json settings, styles and block styles, wired through a PSR-11 container

1.0.0(2mo ago)0161MITPHPPHP ^8.2CI passing

Since Jun 2Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/kaisekidev/kaiseki-wp-theme-json)[ Packagist](https://packagist.org/packages/kaiseki/wp-theme-json)[ Docs](https://github.com/kaisekidev/kaiseki-wp-theme-json)[ RSS](/packages/kaiseki-wp-theme-json/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (17)Versions (6)Used By (0)

kaiseki/wp-theme-json
=====================

[](#kaisekiwp-theme-json)

Type-safe builder for WordPress `theme.json` settings, styles and block styles, wired through a PSR-11 container.

Instead of hand-editing a `theme.json` file, you describe the theme `settings` and `styles` as typed PHP data objects ([`spatie/laravel-data`](https://github.com/spatie/laravel-data)) and let three `kaiseki/wp-hook` `HookProviderInterface`s push them into WordPress at runtime:

- **`ThemeJsonUpdater`** — merges a `ThemeJsonInterface` provider's `settings`/`styles` into the global theme data (the `wp_theme_json_data_theme` filter).
- **`BlockSettingsFilter`** — applies per-block settings (keyed by block name) supplied by `BlockSettingsInterface` implementations.
- **`BlockStylesRegistry`** — registers custom block styles (`register_block_style`) on `init`.

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

[](#installation)

```
composer require kaiseki/wp-theme-json
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

Register `ConfigProvider` with your laminas-style config aggregator, point `theme_json.theme` at your `ThemeJsonInterface` implementation, and activate the providers you want via `kaiseki/wp-hook`.

```
use Kaiseki\WordPress\ThemeJson\BlockSettingsFilter;
use Kaiseki\WordPress\ThemeJson\BlockStyleProperties;
use Kaiseki\WordPress\ThemeJson\BlockStylesRegistry;
use Kaiseki\WordPress\ThemeJson\ThemeJsonUpdater;

return [
    'theme_json' => [
        // A service id resolving to a ThemeJsonInterface implementation.
        'theme' => MyThemeJson::class,
        // Per-block settings: block name => BlockSettingsInterface service id.
        'block_settings' => [
            // 'core/button' => MyButtonSettings::class,
        ],
        // Custom block styles: block name => list of BlockStyleProperties.
        'block_styles' => [
            'core/button' => [
                BlockStyleProperties::create(
                    name: 'fill',
                    label: 'Fill',
                    isDefault: true,
                ),
            ],
        ],
    ],
    'hook' => [
        'provider' => [
            ThemeJsonUpdater::class,
            BlockSettingsFilter::class,
            BlockStylesRegistry::class,
        ],
    ],
];
```

Your `ThemeJsonInterface` implementation returns the typed settings and styles objects:

```
use Kaiseki\WordPress\ThemeJson\Settings\Color;
use Kaiseki\WordPress\ThemeJson\Settings\Color\Palette;
use Kaiseki\WordPress\ThemeJson\Settings\ThemeSettings;
use Kaiseki\WordPress\ThemeJson\Styles\ThemeStyles;
use Kaiseki\WordPress\ThemeJson\ThemeJsonInterface;

final class MyThemeJson implements ThemeJsonInterface
{
    public function getThemeSettings(): ?ThemeSettings
    {
        return new ThemeSettings(
            color: new Color(
                palette: [
                    new Palette(slug: 'primary', color: '#0d6efd', name: 'Primary'),
                    new Palette(slug: 'dark', color: '#212529', name: 'Dark'),
                ],
            ),
        );
    }

    public function getThemeStyles(): ?ThemeStyles
    {
        return new ThemeStyles(css: 'body{line-height:1.6}');
    }
}
```

Null properties are stripped before the data is written, so you only declare the keys you actually set. `ConfigProvider::__invoke()` returns the factory wiring for all three providers.

Development
-----------

[](#development)

```
composer install
composer check   # check-deps, cs-check, phpstan
```

License
-------

[](#license)

MIT — see [LICENSE](LICENSE.md).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance87

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70% 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

Unknown

Total

1

Last Release

70d ago

### Community

Maintainers

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

---

Top Contributors

[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (7 commits)")[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (2 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/kaiseki-wp-theme-json/health.svg)

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k464.3M10.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

707133.3M15.0k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31083.8M2.5k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

568591.1k62](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

762297.9k51](/packages/civicrm-civicrm-core)[symfony/object-mapper

Provides a way to map an object to another object

361.7M65](/packages/symfony-object-mapper)

PHPackages © 2026

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