PHPackages                             jooservices/wordpress-sdk - 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. jooservices/wordpress-sdk

ActiveLibrary[API Development](/categories/api)

jooservices/wordpress-sdk
=========================

A strictly-typed, SOLID-compliant PHP SDK for WordPress REST API

v1.2.0(1mo ago)0144[1 PRs](https://github.com/jooservices/wordpress-sdk/pulls)1MITPHPPHP &gt;=8.5CI passing

Since Feb 2Pushed 1mo agoCompare

[ Source](https://github.com/jooservices/wordpress-sdk)[ Packagist](https://packagist.org/packages/jooservices/wordpress-sdk)[ RSS](/packages/jooservices-wordpress-sdk/feed)WikiDiscussions develop Synced today

READMEChangelog (3)Dependencies (34)Versions (16)Used By (1)

JOOservices WordPress SDK
=========================

[](#jooservices-wordpress-sdk)

[![CI](https://github.com/jooservices/wordpress-sdk/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/jooservices/wordpress-sdk/actions/workflows/ci.yml)[![PHP Version](https://camo.githubusercontent.com/2788132aa1e54031a6c94edcbf8688566d3e18cb5492cd1766836f74a24b27b5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352532422d626c75652e737667)](https://www.php.net/)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/b4c8f68cbc991ba18c17bd360697b359a084e173742b5e4d1c9d9548864e1e94/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f6f73657276696365732f776f726470726573732d73646b)](https://packagist.org/packages/jooservices/wordpress-sdk)

DTO-first PHP 8.5 SDK for the WordPress REST API, built for typed content automation, pagination, media, settings, users, taxonomies, discovery, and custom/plugin endpoints.

Package name: `jooservices/wordpress-sdk`

Install
-------

[](#install)

```
composer require jooservices/wordpress-sdk
```

Quick start
-----------

[](#quick-start)

```
use JOOservices\WordPress\Sdk\Data\Query\ListPostsQuery;
use JOOservices\WordPress\Sdk\WordPressService;

$wordpress = WordPressService::create(
    baseUrl: getenv('WORDPRESS_URL'),
    username: getenv('WORDPRESS_USER'),
    password: getenv('WORDPRESS_APP_PASSWORD'),
);

$posts = $wordpress->posts()->list(new ListPostsQuery(
    perPage: 10,
    search: 'automation',
    fields: 'id,title,link,date',
    embed: true,
));

foreach ($posts as $post) {
    echo $post->title->rendered . PHP_EOL;
}
```

Supported endpoints
-------------------

[](#supported-endpoints)

EndpointServiceStatusPosts`posts()`CRUDPages`pages()`CRUDMedia`media()`list/get/upload/deleteUsers`users()`CRUD + `me()`Comments`comments()`CRUDCategories`categories()`CRUDTags`tags()`CRUDSearch`search()`list/searchTaxonomies`taxonomies()`list/getPost types`postTypes()`list/getStatuses`statuses()`list/getApplication Passwords`applicationPasswords()`list/get/create/delete/deleteAllSettings`settings()`get/updateDiscovery / schema`discovery()`index/routes/schemaCustom endpoints`custom()`GET/POST/PUT/PATCH/DELETE raw arraysRevisions`revisions()`posts/pages/block autosavesPlugins`plugins()`raw admin operationsThemes`themes()`raw admin readsBlocks / block types / renderer / directory`blocks()`, `blockTypes()`, `blockRenderer()`, `blockDirectory()`raw editor operationsMenus / navigation`menuLocations()`, `navigations()`, `navMenus()`, `navMenuItems()`raw navigation operationsTemplates / template parts / global styles`templates()`, `templateParts()`, `globalStyles()`raw block theme operationsWidgets / sidebars`widgets()`, `widgetTypes()`, `sidebars()`raw widget operationsSite Health`siteHealth()`raw diagnostic test readsSee `docs/05-maintenance/02-wordpress-rest-api-coverage-matrix.md` for the post-1.2.0 endpoint-by-endpoint coverage matrix, DTO/query coverage, integration status, capability requirements, and documented gaps against the official WordPress REST API reference.

SDK core boundary
-----------------

[](#sdk-core-boundary)

SDK core covers the native WordPress REST API client surface, typed DTOs, query DTOs, auth, pagination, discovery/schema helpers, error mapping, and generic REST payload helpers.

Not SDK core:

- opinionated content templates for stories, reviews, articles, or other editorial formats
- publishing workflows or editorial orchestration that go beyond the native REST API surface
- plugin/theme implementation logic that is specific to one plugin, theme, or content product

SDK helper extras
-----------------

[](#sdk-helper-extras)

The SDK also ships with optional developer-experience helpers under `JOOservices\WordPress\Sdk\Support`.

- `PostBuilder` helps assemble post payloads fluently before calling `posts()->create()` or `update()`.
- `ContentBuilder` helps generate Gutenberg-compatible block markup in PHP.

These helpers are not native WordPress REST API resources. They remain in the SDK because they are generic payload and Gutenberg markup helpers for normal WordPress post operations.

Content templates for stories, product reviews, articles, and template registries now live in `jooservices/wordpress-content-templates`. That package depends on this SDK and generates SDK-compatible post/page payloads; this SDK does not depend on it.

If a helper becomes tightly coupled to a specific plugin or theme contract, treat it as a maintenance candidate for extraction or deprecation rather than expanding SDK core around that dependency.

DTO-first querying
------------------

[](#dto-first-querying)

The SDK accepts either raw query arrays or typed query DTOs for list and read operations.

```
use JOOservices\WordPress\Sdk\Data\Query\ListCommentsQuery;

$comments = $wordpress->comments()->list(new ListCommentsQuery(
    post: 42,
    status: 'approve',
    perPage: 25,
    fields: 'id,content,date',
));
```

Pagination
----------

[](#pagination)

WordPress pagination headers are exposed through `PaginatedCollection`. List-style services provide auto-pagination helpers where WordPress returns paginated collections.

```
$media = $wordpress->media()->list(['per_page' => 20, 'page' => 2]);

printf(
    "Loaded %d items out of %d across %d pages\n",
    count($media),
    $media->total,
    $media->totalPages,
);
```

```
foreach ($wordpress->posts()->cursor(['per_page' => 50]) as $post) {
    // Streams one page at a time.
}

$wordpress->posts()->each(function ($post): bool {
    return $post->id !== 123; // return false to stop early
}, ['status' => 'publish']);
```

Use `all()` only when loading every matching post into memory is acceptable.

Site settings and custom routes
-------------------------------

[](#site-settings-and-custom-routes)

```
$settings = $wordpress->settings()->get();
$wordpress->settings()->update(['title' => 'New title']);

$routes = $wordpress->discovery()->routes();
$schema = $wordpress->discovery()->schema('/wp/v2/posts');

$items = $wordpress->custom()->get('/my-plugin/v1/items', ['page' => 1]);
$created = $wordpress->custom()->post('/my-plugin/v1/items', ['name' => 'Example']);
```

Custom endpoint paths are relative to the configured WordPress REST API root. Full external URLs are rejected.

Application passwords
---------------------

[](#application-passwords)

```
$password = $wordpress->applicationPasswords()->create('me', [
    'name' => 'Publishing Worker',
]);
```

WordPress returns the raw generated application password only in the create response. Store it immediately in a secret manager and never log it.

Admin and editor endpoint groups
--------------------------------

[](#admin-and-editor-endpoint-groups)

Broad WordPress admin/editor endpoint groups are exposed as raw arrays until their response schemas prove stable enough for public DTO contracts.

```
$plugins = $wordpress->plugins()->list();
$themes = $wordpress->themes()->list();
$revisions = $wordpress->revisions()->posts(123)->list();
$rendered = $wordpress->blockRenderer()->render('core/latest-posts', ['postsToShow' => 3]);
$templates = $wordpress->templates()->list();
$health = $wordpress->siteHealth()->backgroundUpdates();
```

Most of these endpoints require authenticated users with admin/editor capabilities. Block renderer requests are sent with WordPress editor context because the REST renderer endpoint validates dynamic blocks against editor-only route context.

Error handling
--------------

[](#error-handling)

```
use JOOservices\WordPress\Sdk\Exceptions\UnauthorizedException;
use JOOservices\WordPress\Sdk\Exceptions\WordPressApiException;

try {
    $wordpress->posts()->get(123, ['context' => 'edit']);
} catch (UnauthorizedException $exception) {
    // Refresh credentials or verify the app password.
} catch (WordPressApiException $exception) {
    $payload = $exception->toArray(); // sanitized diagnostic payload
}
```

Documentation
-------------

[](#documentation)

Start with:

- [Documentation hub](./docs/README.md)
- [Architecture overview](./docs/00-architecture/01-project-overview.md)
- [Installation](./docs/01-getting-started/01-installation.md)
- [Quick start](./docs/01-getting-started/02-quick-start.md)
- [User guide](./docs/02-user-guide/01-services-and-queries.md)
- [Development](./docs/04-development/01-setup.md)
- [Risks and scope boundary](./docs/05-maintenance/01-risks-and-gaps.md)
- [WordPress REST API coverage matrix](./docs/05-maintenance/02-wordpress-rest-api-coverage-matrix.md)

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

[](#development)

```
composer lint
composer lint:all
composer test
composer test:integration
composer test:coverage
composer test:coverage:gate
composer test:coverage-map
composer quality
composer check
composer ci
```

Run `composer test:integration` only against a disposable local WordPress test site created for SDK testing. The stale Docker/WP Composer aliases from pre-release documentation are not shipped in 1.2.0 because their runner files are not present in this repository.

`composer test:coverage` now includes a Clover XML audit gate. Aggregate statement coverage must stay at or above 90%, and no coverable production file, class, or method in `src/` may remain at 0% coverage unless it has a documented exclusion reason in `tools/test-coverage-gate.php`.

Security
--------

[](#security)

Use WordPress application passwords through environment variables. Do not commit live credentials, and do not log authorization headers or raw secrets. See [SECURITY.md](./SECURITY.md).

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance90

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

Established project with proven stability

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

Total

3

Last Release

47d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/142772948?v=4)[JOOservices Ltd](/maintainers/jooservices)[@jooservices](https://github.com/jooservices)

---

Top Contributors

[![soulevilx](https://avatars.githubusercontent.com/u/2688707?v=4)](https://github.com/soulevilx "soulevilx (67 commits)")

---

Tags

cmscomposer-packagecontent-automationdtojooservicesphpphp85rest-apisdktyped-datawordpresswordpress-rest-apiwordpress-sdkwordpresssdkdtowordpress-rest-apicontent-apiapplication-passwords

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/jooservices-wordpress-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/jooservices-wordpress-sdk/health.svg)](https://phpackages.com/packages/jooservices-wordpress-sdk)
```

###  Alternatives

[api-platform/core

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

2.6k51.2M338](/packages/api-platform-core)[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[api-platform/serializer

API Platform core Serializer

274.8M87](/packages/api-platform-serializer)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)

PHPackages © 2026

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