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)01.9k↓33.3%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 1mo 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

31

—

LowBetter than 68% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

621d 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

[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

251.7M1](/packages/mollie-oauth2-mollie-php)[jcroll/foursquare-api-client

PHP Foursquare Api Client built on Guzzle

40104.7k1](/packages/jcroll-foursquare-api-client)[andalisolutions/oauth2-anaf

Anaf OAuth 2.0 support for the PHP League's OAuth 2.0 Client

194.1k](/packages/andalisolutions-oauth2-anaf)

PHPackages © 2026

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