PHPackages                             joeybeninghove/json-api-wp-client - 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. joeybeninghove/json-api-wp-client

ActiveLibrary[API Development](/categories/api)

joeybeninghove/json-api-wp-client
=================================

WordPress client library for consuming JSON APIs following the 1.0 spec at jsonapi.org

0.1.1(9y ago)13111MITPHPPHP &gt;= 5.6

Since Feb 7Pushed 9y ago1 watchersCompare

[ Source](https://github.com/joeybeninghove/json-api-wp-client)[ Packagist](https://packagist.org/packages/joeybeninghove/json-api-wp-client)[ RSS](/packages/joeybeninghove-json-api-wp-client/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (1)

JSON API WordPress Client
=========================

[](#json-api-wordpress-client)

This library is an opinionated, resource-based JSON API client for WordPress that strives to adhere to the offical [JSON API 1.0 spec](http://jsonapi.org).

Requirements
------------

[](#requirements)

- WordPress

Usage
-----

[](#usage)

### Define a resource

[](#define-a-resource)

- `base_url` is specified as the root URL used when interacting with the API.
- `type` is the [JSON API type](http://jsonapi.org/format/#document-resource-objects) for the current resource

```
class Invoice extends Json_Api_Wp_Resource
{
    public function __construct()
    {
        parent::__construct(
            "https://api.site.com/v1/", // base URL
            "invoices" // type
        )
    }
}
```

### Set up HTTP Authentication

[](#set-up-http-authentication)

The `username` is required, but the `password` is optional and defaults to blank.

```
Json_Api_Wp_Resource::auth( "jdoe", "secret" );
```

#### API Key example

[](#api-key-example)

If you're using a typical API key over HTTP Authentication, here is an example of using a base class to abstract that away.

```
class Base extends Json_Api_Wp_Resource
{
    public function __construct( $type )
    {
        parent::__construct( "http://api.site.come/v1/", $type );
    }

    public static function set_api_key( $api_key )
    {
        parent::auth( $apiKey );
    }
}

class Invoice extends Base
{
    public function __construct()
    {
        parent::__construct( "invoices" );
    }
}

Base::set_api_key( "some secret key" );
$invoices = Invoice::get_all();
```

### Create a resource

[](#create-a-resource)

```
$invoice = Invoice::create([
    "description" => "T-Shirt",
    "total" => 10.95
]);
```

### Update a resource

[](#update-a-resource)

This library does not yet support updating of resources because of the lack of `PATCH` support in the WordPress HTTP library.

### Get a single resource

[](#get-a-single-resource)

```
$invoice = Invoice::get_one( "invoice_123" );
```

### Get all resources

[](#get-all-resources)

```
$invoices = Invoice::get_all();
```

### Delete a resource

[](#delete-a-resource)

This library does not yet support updating of resources because of the lack of `DELETE` support in the WordPress HTTP library.

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

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

Total

2

Last Release

3426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b4a01f5152da9e683857b536b05b6a2204fb6506386ee523d759cfb9f9503392?d=identicon)[joeybeninghove](/maintainers/joeybeninghove)

---

Top Contributors

[![joeybeninghove](https://avatars.githubusercontent.com/u/31863?v=4)](https://github.com/joeybeninghove "joeybeninghove (11 commits)")

---

Tags

jsonjson-apijsonapiwordpresswordpress-php-libraryjsonapiwordpress

### Embed Badge

![Health badge](/badges/joeybeninghove-json-api-wp-client/health.svg)

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

###  Alternatives

[nathanmac/parser

Simple PHP Parser Utility Library for API Development

2121.0M3](/packages/nathanmac-parser)[wp-graphql/wp-graphql-woocommerce

WooCommerce bindings for WPGraphQL

70055.0k](/packages/wp-graphql-wp-graphql-woocommerce)[nekojira/wp-api-menus

Extends WordPress WP API with menu routes.

1391.5k](/packages/nekojira-wp-api-menus)[nilportugues/jsonapi-bundle

Symfony 2 &amp; 3 JSON API Transformer Package

11446.4k](/packages/nilportugues-jsonapi-bundle)[cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

141.7M4](/packages/cloudcreativity-json-api-testing)[walle89/swedbank-json

Unofficial API client for the Swedbank's and Sparbanken's mobile apps in Sweden.

772.5k](/packages/walle89-swedbank-json)

PHPackages © 2026

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