PHPackages                             kaiseki/wp-rest-api - 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. [API Development](/categories/api)
4. /
5. kaiseki/wp-rest-api

ActiveLibrary[API Development](/categories/api)

kaiseki/wp-rest-api
===================

Register WordPress REST API routes from typed, container-built route definitions

1.0.0(1mo ago)0911MITPHPPHP ^8.2CI passing

Since Feb 6Pushed 3w ago2 watchersCompare

[ Source](https://github.com/kaisekidev/kaiseki-wp-rest-api)[ Packagist](https://packagist.org/packages/kaiseki/wp-rest-api)[ Docs](https://github.com/kaisekidev/kaiseki-wp-rest-api)[ RSS](/packages/kaiseki-wp-rest-api/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (32)Versions (7)Used By (0)

kaiseki/wp-rest-api
===================

[](#kaisekiwp-rest-api)

Register WordPress REST API routes from typed, container-built route definitions.

Declare your routes in config and implement small, type-safe callback classes instead of hand-wiring `register_rest_route()` on `rest_api_init`. `RestRouteRegistry` (a `kaiseki/wp-hook` provider) reads the `rest_api` config, resolves each callback from the container, and registers the routes for you.

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

[](#installation)

```
composer require kaiseki/wp-rest-api
```

Requires PHP 8.2 or newer.

Usage
-----

[](#usage)

Implement a route callback (and optionally a permission callback):

```
use Kaiseki\WordPress\RestApi\RestRouteCallbackInterface;
use WP_REST_Request;
use WP_REST_Response;

final class GetThings implements RestRouteCallbackInterface
{
    public function __invoke(WP_REST_Request $request): WP_REST_Response
    {
        return new WP_REST_Response(['things' => []]);
    }
}
```

Register `ConfigProvider`, then declare routes under the `rest_api` config key:

```
use Kaiseki\WordPress\RestApi\RestRoutePermissionCallbackInterface;
use WP_REST_Server;

return [
    'rest_api' => [
        'namespace' => 'my-plugin/v1',
        'route_configs' => [
            'things' => [
                'methods' => WP_REST_Server::READABLE,
                'callback' => GetThings::class,
                // a callable-string, or a RestRoutePermissionCallbackInterface class-string
                'permission_callback' => '__return_true',
                'args' => [],
                // optional per-route namespace override
            ],
        ],
    ],
];
```

On `rest_api_init`, `RestRouteRegistry` registers `my-plugin/v1/things`. Each `route_configs` entry maps a route path to its `methods`, `callback`, `permission_callback`, optional `args`, and an optional `namespace` override. Permission callbacks are either a callable-string (e.g. `'__return_true'`) or a class implementing `RestRoutePermissionCallbackInterface`(`__invoke(WP_REST_Request): WP_Error|bool`).

Routes can also be supplied as ready-made `RestRouteInterface` objects via the `rest_api.routes`config key (container class-strings), in addition to — or instead of — `route_configs`.

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

[](#development)

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

License
-------

[](#license)

MIT — see [LICENSE](LICENSE).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 52.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 ~1574 days

Total

2

Last Release

34d ago

PHP version history (2 changes)1.0.x-devPHP ^7.4

1.0.0PHP ^8.2

### Community

Maintainers

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

---

Top Contributors

[![davidmondok](https://avatars.githubusercontent.com/u/3883758?v=4)](https://github.com/davidmondok "davidmondok (10 commits)")[![wolfgangschaefer](https://avatars.githubusercontent.com/u/26325205?v=4)](https://github.com/wolfgangschaefer "wolfgangschaefer (8 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-rest-api/health.svg)

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[api-platform/state

API Platform state interfaces

274.9M136](/packages/api-platform-state)[testo/testo

A lightweight PHP testing framework.

1959.3k55](/packages/testo-testo)[storyblok/php-content-api-client

PHP Client for Storyblok Content API

11176.5k11](/packages/storyblok-php-content-api-client)

PHPackages © 2026

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