PHPackages                             sidus/api-client-bundle - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. sidus/api-client-bundle

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

sidus/api-client-bundle
=======================

Ease the creation of business API client with authentication, serialization and cache

v1.0.3(1y ago)02.2k↓18.8%MITPHPPHP &gt;=8.1

Since Aug 13Pushed 1y ago1 watchersCompare

[ Source](https://github.com/VincentChalnot/ApiClientBundle)[ Packagist](https://packagist.org/packages/sidus/api-client-bundle)[ Docs](https://github.com/VincentChalnot/api-client-bundle)[ RSS](/packages/sidus-api-client-bundle/feed)WikiDiscussions v1.0-dev Synced 2w ago

READMEChangelogDependencies (6)Versions (5)Used By (0)

Sidus/ApiClientBundle
=====================

[](#sidusapiclientbundle)

Introduction
------------

[](#introduction)

This library provides basic blocks for building a business oriented OAuth API client very easily.

### Features

[](#features)

- Automatic token negotiation
- Serialization and deserialization of API requests and responses
- Cache layer for API responses
- Easy to extend and customize

Basic usage
-----------

[](#basic-usage)

### Simple request:

[](#simple-request)

```
/** @var \Sidus\ApiClientBundle\ApiClient $apiClient */

$apiRequest = new \Sidus\ApiClientBundle\Model\Request\AuthenticatedApiRequest(
    new \Sidus\ApiClientBundle\Model\Request\Component\HttpComponent(
        baseUri: 'https://api.example.com',
        path: '/api/v1/resource',
    ),
);

$response = $apiClient->query($apiRequest);

$response->getBody(); // Raw response content
```

### Using normalizations/denormalization:

[](#using-normalizationsdenormalization)

```
/** @var \Sidus\ApiClientBundle\ApiClient $apiClient */

$apiRequest = new \Sidus\ApiClientBundle\Model\Request\AuthenticatedApiRequest(
    new \Sidus\ApiClientBundle\Model\Request\Component\HttpComponent(
        baseUri: 'https://api.example.com',
        path: '/api/v1/resource',
        method: 'POST',
    ),
);

$apiRequest->setSerializationComponent(
    new \Sidus\ApiClientBundle\Model\Request\Component\SerializationComponent(
        content: new Resource(),
    ),
);
$apiRequest->setDeserializationComponent(
    new \Sidus\ApiClientBundle\Model\Request\Component\DeserializationComponent(
        className: ResourceResponse::class,
    ),
);

$response = $apiClient->query($apiRequest);

$responseResource = $response->getContent(); // Deserialized response content
```

### Using cache:

[](#using-cache)

```
/**
 * @var \Sidus\ApiClientBundle\ApiClient $apiClient
 * @var \Sidus\ApiClientBundle\Model\Request\ApiRequest $apiRequest
 */

$apiRequest->setCacheComponent(
    new \Sidus\ApiClientBundle\Model\Request\Component\CacheComponent(
        ttl: 3600,
    ),
);
```

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

[](#installation)

```
composer require sidus/api-client-bundle
```

Configuration
-------------

[](#configuration)

You have two options to provide credentials for token negotiation:

Declare a Credentials service:

```
services:
    app.oauth_credentials:
        class: Sidus\ApiClientBundle\Credentials
        arguments:
            $baseUrl: 'https://api.example.com'
            $path: '/oauth/token' # Token negotiation endpoint
            $authenticationParams: # What you send to the token negotiation endpoint
                username: 'xxxx'
                password: 'xxxx'
```

Each time you create an API request using the same base URL, the credentials will be automatically used.

Or you can provide the access token directly in the API request:

```
$apiRequest = new \Sidus\ApiClientBundle\Model\Request\AuthenticatedApiRequest(
    new \Sidus\ApiClientBundle\Model\Request\Component\HttpComponent(
        baseUri: 'https://api.example.com',
        path: '/api/v1/resource',
    ),
);
$apiRequest->setAuthorizationComponent(
    new Sidus\ApiClientBundle\Model\Authorization\OAuthToken(
        accessToken: 'xxxx',
    ),
);
```

Or any custom authorization component implementing the `\Sidus\ApiClientBundle\Contracts\Request\Component\AuthorizationComponentInterface`.

When using custom headers, simply add the custom header in the API request:

```
$apiRequest->addHeader('X-Custom-Header', 'value');
```

Or use an event listener to add the header automatically using the `\Sidus\ApiClientBundle\Model\Event\ApiRequestEvent`event.

###  Health Score

30

—

LowBetter than 61% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

4

Last Release

714d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d58f1d81808beea6dab7aec03b0268082fe12bf46c852f14d98d7b900ea1304?d=identicon)[VincentChalnot](/maintainers/VincentChalnot)

---

Top Contributors

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

---

Tags

apiclientserializercacheoauthsidus

### Embed Badge

![Health badge](/badges/sidus-api-client-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

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

8.5k6.0M778](/packages/sylius-sylius)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6943.5M449](/packages/drupal-core-recommended)[shopware/platform

The Shopware e-commerce core

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

Shopware platform is the core for all Shopware ecommerce products.

595.8M674](/packages/shopware-core)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

86337.5k](/packages/flow-php-flow)

PHPackages © 2026

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