New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

middag-io/wordpress

MIDDAG WordPress adapter — persistence, REST, hooks, cron, Inertia frontend, and email for WordPress plugins
5,276

Larablocks Analysis

middag-io/wordpress works with any PHP project: the latest release (v1.19.0, Nov 24, 2026) doesn't depend on Laravel.

Recommendation checks

Solid choice

Solid choice: maintained and up to date, meets 1 of 3 checks; below the bar for Recommended on use.

  • Released in the last 12 months (Nov 24, 2026)
  • 2,699 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Actively maintained
  • Last stable release: Nov 24, 2026.
  • Latest pre-release: v2.0.0-rc.1, Nov 25, 2026.
  • 36 releases in the last 12 months.
  • First released: Jun 26, 2026.
  • Monthly downloads: 2,699, up 3869% from six months ago.
  • 1 open issue on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Dec 2, 2026.

Install
composer require middag-io/wordpress
Latest Version:v1.19.0
PHP:^8.3
License:Apache-2.0
Last Updated:Dec 1, 2026
Links: GitHub  ·  Packagist
Maintainer: michaelmeneses

middag-io/wordpress

CI License: Apache 2.0 PHP

MIDDAG WordPress adapter — persistence, three routing surfaces (REST / admin / public rewrite), hooks, cron, Inertia frontend, and email implementations of the middag-io/framework contracts for WordPress.

Documentation: Reference — WordPress Adapter on docs.middag.dev.

What this package is

middag-io/wordpress is the WordPress host adapter for the MIDDAG framework. It provides the WordPress-side implementations of the framework's adapter contracts: $wpdb connection and SQL dialect, REST controllers, hooks, wp-cron, config and user context, translation, Inertia frontend glue, wp_mail email, and native post/user persistence.

It binds the framework to a WordPress site. A WordPress plugin provides the composition root that wires it in.

What it does not include

  • No product features or governed domain capabilities (item storage, query engine, audit and activity feeds, payments, CRM and similar).
  • No dependency on a MIDDAG package other than the OSS middag-io/framework and middag-io/ui. The AdapterPluginIsolationTest guard test (part of composer test) allows only the OSS MIDDAG namespaces in src/.
  • No bearer-token or JWT code: a consumer that accepts tokens injects its own RequestAuthenticatorInterface.
  • No bundled WordPress plugin. You wire the adapter into your own plugin.

Requirements

Item Supported
PHP ^8.3: 8.3 to 8.6, with ext-json
Symfony ^7.4 || ^8.1 for every Symfony component it requires. PHP 8.3 resolves Symfony 7.4; PHP 8.4 to 8.6 can resolve 8.x
middag-io/framework ^2.0.0-rc.1 during the 2.0 release candidates, ^2.0 from 2.0.0 (it brings middag-io/ui)
WordPress 7.0 and 7.1: the latest major and the previous one. The previous major leaves 6 months after the new major ships; a courtesy backport by WordPress does not extend that. Within the PHP versions each one supports
Database MySQL 8.0 and 8.4, MariaDB 10.11 and 11.4 (the LTS series of each), as $wpdb reaches them

CI runs the test suite on PHP 8.3 to 8.6 with the platform pinned to PHP 8.3.0 (the locked cells), a highest job on PHP 8.4, 8.5 and 8.6 that asserts the Symfony 8 major, a lowest job on PHP 8.3 that resolves the lowest version of every dependency and asserts the Symfony 7.4 floor, PHPStan read as PHP 8.3 (the floor) and as PHP 8.6 (the ceiling), PHPStan against the WordPress 7.0 and 7.1 stubs, and the integration suite against a real WordPress 7.0 and 7.1 (the newest patch release of each) on MySQL 8.0 and 8.4 and on MariaDB 10.11 and 11.4. The platform rules are on Platform.

Installation

composer require middag-io/wordpress

This pulls middag-io/framework automatically, which in turn pulls middag-io/ui — the framework's frontend toolkit that backs this adapter's Inertia frontend glue.

Host integration

A WordPress plugin owns the composition root that wires the adapter in. The adapter ships an abstract kernel that formalizes it: subclass Middag\WordPress\Runtime\Kernel, provide the singleton storage and the compiled container (see the class docblock for the two-method contract), and call YourKernel::init() on plugins_loaded. Boot wires HookRegistrar and CronRegistrar (init, priority 5) and RestRouteRegistrar (rest_api_init) whenever your container binds them — everything product-specific goes in your onBoot() override. The kernel holds no static state; the singleton lives on YOUR subclass, so two plugins built on the adapter never share a kernel in one request.

One copy of the library per PHP process. Every plugin on a site loads the same middag-io/wordpress classes, and PHP keeps the copy of the first autoloader that resolves them. The version that loads first wins for the whole process, so every plugin on the site must accept the version that is loaded; the wp <root> doctor report below shows the file each package's entry class was loaded from and, when the package declares one, the autoloader it chose.

What the host must still do at boot:

  • Inject the component identity. Build new WpComponentContext($componentName, $assetVersion, $basePath) once and bind it in your own container as the framework HostComponentContextInterface, so the services that need it (the REST, admin and public routing registrars, CronRegistrar, InertiaAdapter, EmailSender) receive it by injection. Do not register it with the framework's HostContext::set(): that slot is one per PHP process, and with several plugins in one request the last plugin to boot would win.

  • Pass your own names. Every adapter default uses the neutral middaglib marker, which names no product. Bind the classes with your plugin's own values:

    Class Default Constructor argument
    WpConfigResolver MIDDAGLIB_ / middaglib_ $envPrefix, $optionPrefix
    WpHostEventBridge hook prefix middaglib/ $hookPrefix
    WpHookfileLoader filter middaglib_hookfiles, file middaglib_hooks.php $filterName, $hookfileName
    WpTranslator text domain middaglib $defaultDomain
    CacheSupportPsr16 wp_cache group middaglib_{area} $groupPrefix
    DiagnosticsRegistry filter middaglib_diagnostics $filterName
    DoctorCommandRegistrar WP-CLI root middaglib (wp middaglib doctor) $root

    $hookfileName comes after $logger, so set it with a named argument: new WpHookfileLoader(filterName: 'acme_hookfiles', hookfileName: 'acme_hooks.php').

The #[Auth] guarantees below hold for REST routes declared with #[Route] and registered with RestRouteAttributeRegistrar. The imperative RestRouteRegistrar authorizes only through the permission callbacks a controller passes to register_rest_route(), and refuses with a LogicException a controller that declares #[Auth] anywhere (class, method, ancestor, trait or interface).

REST routes declared with #[Auth] require login by default. Every capability an #[Auth] lists must pass user_can() for the user the injected RequestAuthenticatorInterface resolved (a token user included). The object id of a meta capability is the requirement's instanceid option, else the instanceid of its capability definition's options, else the declaring #[Auth]'s instanceId. Grant your plugin's capabilities to the roles that need them, administrators included. An object id of 0 is a global check. The check fails closed: a resolved user with ID 0 gets 401, an instanceid that is not a non-negative integer gets 403, and a throw while the requirements are resolved is logged and gets 403, not 500.

Admin page controllers that extend AbstractWpController resolve the object id the same way: a capability inherited from an ancestor's #[Auth] is checked with that declaration's instanceId (none means a global check), never with the instanceId of a nearer declaration. Context levels are ignored. See WP-005.

Shortcodes registered through ShortcodeSupport::add() or a ShortcodeDefinition are sanitized by default: the handler's output goes through wp_kses_post() before WordPress puts it on the page, so a handler that echoes an author's attribute cannot inject <script>. A handler that must return markup outside that allowlist carries the framework's #[TrustedOutput] attribute (on the closure or function, on the invokable class or its __invoke(), or on the method of a method callable) and then answers for its own escaping.

See WP-002, Configuration & Identity and Routing Surfaces for the details.

Logging needs no priming: the adapter's operational sites (cron dispatch, email send/render) resolve their PSR-3 logger per call through Middag\WordPress\Support\LogSupport::resolve($container) — an explicit Psr\Log\LoggerInterface binding wins, then the framework's channel LoggerFactory, then the error_log() fallback.

Boot diagnostics

Middag\WordPress\Diagnostics answers "did my package boot?" from the command line. Each package declares a PackageProbe (name, version, kernel class, optional entry class and extra checks) on a DiagnosticsRegistry from its main plugin file, before the kernel boots. The registry rides on a WordPress filter, so every plugin that shares the filter name meets in one report. DoctorCommandRegistrar adds wp <root> doctor, which prints a BootReport (autoloader resolved and from which file, kernel booted, version, the package's own checks). It exits 1 when a check fails or an expected package never registered (--expect=a,b) and 0 otherwise; --strict also fails on warnings and --format=json prints one JSON document.

$registry = new DiagnosticsRegistry('acme_diagnostics');
$registry->register(new PackageProbe('acme-shop', ACME_SHOP_VERSION, AcmeShopKernel::class));
(new DoctorCommandRegistrar(new DoctorCommand($registry, ['acme-shop']), 'acme'))->register();

A gate should pass the full package list with --expect (for example wp acme doctor --expect=acme-shop,acme-quotes). The constructor list only runs when the package that registered the command loaded, so it cannot catch that package's own absence. A package whose bootstrap chooses between autoloaders passes the chosen file as PackageProbe::$autoloaderPath, and the autoload check reports it.

The built-in checks prove boot, not render. A package can add a DiagnosticCheckInterface (or a CallbackCheck) with CheckScope::Render, for example "the admin page still emits its HTML shell and the core script bundles". Until one runs, the report states that it covers boot only.

Development

git clone https://github.com/middag-io/middag-php-wordpress
cd middag-php-wordpress
composer install

Run the quality gates and the test suite:

composer check   # PHP-CS-Fixer + Rector (dry-run) + PHPStan
composer test    # PHPUnit (includes the boundary and architecture guards)

The integration suite (tests/Integration) runs on a real WordPress and a real MySQL or MariaDB database; see tests/Integration/README.md.

composer.json pins config.platform.php to 8.3.0, so Composer resolves the lowest PHP of the range locally. composer.lock is gitignored, like a typical library. Git hooks are configured automatically via post-install-cmd; the commit-msg hook enforces Conventional Commits. See CONTRIBUTING.md for the contributor setup.

Releases

Releases are managed by release-please. The library shares only the MAJOR with the other open-source middag-php-* libraries; MINOR and PATCH are per library, and the supported WordPress versions belong to this adapter. See API-STABILITY.md and Versioning and compatibility.

Help and status

Maintenance

The middag-php-* libraries are maintained by MIDDAG for its own products. Issues and pull requests from outside are handled on a best-effort basis, with no response-time commitment. Security reports follow SECURITY.md. Conduct reports go to opensource@middag.io.

License

Licensed under the Apache License 2.0. See NOTICE for attribution.

Related Packages

middag-io/moodle

MIDDAG Moodle adapter — platform bindings, ACL layer, and Moodle-specific implem...

8,872 0
pollora/schedule

Scheduled and deferred tasks for WordPress: one engine, a fluent API and #[Sched...

25,021 1
swancreative/laravel-wp-api

Laravel package for the Wordpress JSON REST API forked from threesquared

2,855 3
ejklock/ci4-inertia

Server-side Inertia.js adapter for CodeIgniter 4.

12 0
webkulwp/inertia

Inertia.js server-side adapter for PHP. Handles full visits, Inertia XHR visits,...

11 17

Version History

Version Released PHP License
v1.19.0 ^8.3 Apache-2.0
v1.18.2 ^8.3 Apache-2.0
v1.18.1 ^8.3 Apache-2.0
v1.18.0 ^8.3 Apache-2.0
v1.17.1 ^8.3 Apache-2.0
Pre-releases (1)
Version Released PHP License
v2.0.0-rc.1 ^8.3 Apache-2.0