PHPackages                             timostamm/json-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. [HTTP &amp; Networking](/categories/http)
4. /
5. timostamm/json-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

timostamm/json-client
=====================

A simple client for JSON APIs using Guzzle and the Symfony Serializer.

v3.2.0(7mo ago)12341[1 issues](https://github.com/timostamm/json-client/issues)MITPHPPHP ^8.0CI passing

Since May 14Pushed 7mo ago2 watchersCompare

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

READMEChangelog (10)Dependencies (5)Versions (16)Used By (0)

json-client
===========

[](#json-client)

[![build](https://github.com/timostamm/json-client/workflows/CI/badge.svg)](https://github.com/timostamm/json-client/actions?query=workflow:%22CI%22)[![Packagist PHP Version](https://camo.githubusercontent.com/d526438f14044acf1c6d7c6ed13be7de2a35b5ac97dacf83edc2294903147a93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f74696d6f7374616d6d2f6a736f6e2d636c69656e742f706870)](https://camo.githubusercontent.com/d526438f14044acf1c6d7c6ed13be7de2a35b5ac97dacf83edc2294903147a93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f74696d6f7374616d6d2f6a736f6e2d636c69656e742f706870)[![GitHub tag](https://camo.githubusercontent.com/ec0d6c71935a0580c15c85bb63b20f4c1798da23ed76ef7566b05c59298bee1c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f74696d6f7374616d6d2f6a736f6e2d636c69656e743f696e636c7564655f70726572656c65617365733d26736f72743d73656d76657226636f6c6f723d626c7565)](https://github.com/timostamm/json-client/releases/)[![License](https://camo.githubusercontent.com/d6bc2b26794002c24d023acaab01b6dbb953c57ab9cb80ba5b8aa2f2bd5de99a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c7565)](#license)

A simple client for JSON APIs using Guzzle and the Symfony Serializer.

To implement a API client, you can extend AbstractApiClient and write your methods, using the Guzzle Http Client to transmit.

```
class MyClient extends AbstractApiClient {

    /**
     * @throws TransferException
     */
    public function send(Model $model):void
    {
        // The data will automatically be
        // serialized to JSON.
        $this->http->post('model', [
            'data' => $model
        ]);
    }

    /**
     * @param int $id
     * @throws TransferException
     * @returns Model
     */
    public function get(int $id):Model
    {
        $response = $this->http->get('model/'.$id, [
            'deserialize_to' => Model::class
        ]);

        if (!$response instanceof DeserializedResponse) {
            throw new \RuntimeException('Expected a DeserializedResponse, got: '.get_class($response));
        }

        return $response->getDeserializedData();
    }

}
```

All functionality is implemented as middleware, the `AbstractApiClient` just configures the Guzzle `HandlerStack` for you.

### Provided middleware

[](#provided-middleware)

#### Serialization

[](#serialization)

See `DeserializeResponseMiddleware` and `SerializeRequestBodyMiddleware`.

#### Server error messages

[](#server-error-messages)

`ServerMessageMiddleware` provides support for JSON error messages.

#### Response expectations

[](#response-expectations)

If you want to make sure that a response has a specific header, content type or other feature, use `ResponseExpectationMiddleware`.

#### Logging

[](#logging)

There is also middleware to log all HTTP requests (and corresponding response or exception), see `HttpLoggingMiddleware`

An adapter for `Psr\Log\LoggerInterface` is available.

This middleware is not added by default because the order is important: The `HttpLoggingMiddleware` must be added last.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance43

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 73.2% 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 ~192 days

Recently: every ~643 days

Total

15

Last Release

227d ago

Major Versions

v1.0.7 → 2.0.02018-09-03

v2.1.0 → v3.0.02025-06-16

PHP version history (3 changes)v1.0.0PHP &gt;=7.1

v2.1.0PHP ^7.2 || ^8.0

v3.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6364011a12f22cb5046056371bde6170218218c560eddfdc08b4644b7648af78?d=identicon)[timostamm](/maintainers/timostamm)

---

Top Contributors

[![timostamm](https://avatars.githubusercontent.com/u/4289451?v=4)](https://github.com/timostamm "timostamm (30 commits)")[![ducrot](https://avatars.githubusercontent.com/u/3525119?v=4)](https://github.com/ducrot "ducrot (11 commits)")

---

Tags

apiguzzlehttpjsonserializersymfony

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/timostamm-json-client/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)

PHPackages © 2026

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