PHPackages                             itkg/consumer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. itkg/consumer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

itkg/consumer
=============

Itkg consume library

2.0.0(9y ago)127.9k5[1 issues](https://github.com/itkg/consumer/issues)[1 PRs](https://github.com/itkg/consumer/pulls)1MITPHPPHP &gt;=5.3.3

Since Feb 7Pushed 9y ago28 watchersCompare

[ Source](https://github.com/itkg/consumer)[ Packagist](https://packagist.org/packages/itkg/consumer)[ Docs](http://github.com/itkg/consumer)[ RSS](/packages/itkg-consumer/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (7)Versions (12)Used By (1)

Webservice consumer library
===========================

[](#webservice-consumer-library)

[![Build Status](https://camo.githubusercontent.com/0f66f5a2f493c41d8922407d40f2087b99a3b02dfb09978f9877f25d79e8a467/68747470733a2f2f7472617669732d63692e6f72672f69746b672f636f6e73756d65722e706e673f6272616e63683d322e30)](https://travis-ci.org/itkg/consumer)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/d8aa06f2a14d9e8098f4c9d0ea2b49c6629fe5cedacd8f13ce8b4fee16992480/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69746b672f636f6e73756d65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itkg/consumer/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/48b0c6a0d2b9efbea7f6fb51589d73577a47107754d3183508ba1329eedede8e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f69746b672f636f6e73756d65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/itkg/consumer/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/12a6d83c2672a86ba167a155b9d37c3f09bc822aa4bd68e4d954f4b21cc76bc6/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f63303266353062612d353939632d346637612d616134312d3435653130613761613833392f736d616c6c2e706e67)](https://insight.sensiolabs.com/projects/c02f50ba-599c-4f7a-aa41-45e10a7aa839)

features
--------

[](#features)

- Rest &amp; Soap consumer library
- Webservice caching
- Logging
- OAuth management

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

[](#installation)

### Installation by Composer

[](#installation-by-composer)

If you use composer, add library as a dependency to the composer.json of your application

```
    "require": {
        "itkg/consumer": "dev-master"
    }
```

Usage
-----

[](#usage)

Simple example of Rest WS

```
$service =  new \Itkg\Consumer\Service\Service(
    $eventDispatcher,
    new Itkg\Consumer\Client\RestClient(array(
        'timeout' => 10
    )),
    array(
        'identifier' => 'my test'
    )
);

$response = $service
    ->sendRequest(\Symfony\Component\HttpFoundation\Request::create('http://URL/OF/MY/WEBSERVICE.json'))
    ->getResponse();
```

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

[](#configuration)

### Logs

[](#logs)

- Create a new logger instance

```
$service =  new \Itkg\Consumer\Service\Service(
    $eventDispatcher,
    new Itkg\Consumer\Client\RestClient(array(
        'timeout' => 10
    )),
    array(
        'identifier' => 'my test',
        'logger'     => new \Monolog\Logger('my_logger', array(new \Monolog\Handler\StreamHandler('/tmp/test'))),
    )
);
```

- Add logger listener to your event dispatcher

```
$eventDispatcher->addSubscriber(new \Itkg\Consumer\Listener\LoggerListener());
```

### Serialization

[](#serialization)

- Add Deseralizer listener to your event dispatcher (Create serializer with JMS serializer builder)

```
    $eventDispatcher->addSubscriber(
        new \Itkg\Consumer\Listener\DeserializerListener(JMS\Serializer\SerializerBuilder::create()->build())
    );
```

- Define response\_type &amp; response\_format

```
$service =  new \Itkg\Consumer\Service\Service(
    $eventDispatcher,
    new Itkg\Consumer\Client\RestClient(array(
        'timeout' => 10
    )),
    array(
        'identifier' => 'my test',
        'reponse_format' => 'xml,
        'response_type'  => 'My\Class
    )
);
```

- Get deserialized content like this

```
$object = $service->getResponse()->getDeserializedContent();
```

### Cache

[](#cache)

- Add Cache listener to your event dispatcher

```
    $eventDispatcher->addSubscriber(
        new \Itkg\Consumer\Listener\CacheListener($eventDispatcher)
    );
```

- Add cache adapter to your service (see :  for adapters list)

```
$service =  new \Itkg\Consumer\Service\Service(
    $eventDispatcher,
    new Itkg\Consumer\Client\RestClient(array(
        'timeout' => 10
    )),
    array(
        'identifier' => 'my test',
        'cache_adapter' => new \Itkg\Core\Cache\Adapter\Registry(),
        'cache_ttl => 10000
    )
);
```

- You can define serialize &amp; deserialize method by defining 'cache\_serializer' &amp; 'cache\_deserializer' options

###  Health Score

31

↓

LowBetter than 68% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community24

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 80.4% 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 ~182 days

Recently: every ~175 days

Total

6

Last Release

3565d ago

Major Versions

0.9 → 2.0.02016-08-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/03648c83a4f692316476e37ab6712b56d6beb7f33851dc0c0843a372c0eac3d2?d=identicon)[interakting](/maintainers/interakting)

---

Top Contributors

[![pdenis](https://avatars.githubusercontent.com/u/1713289?v=4)](https://github.com/pdenis "pdenis (205 commits)")[![itkg-jbrousseau](https://avatars.githubusercontent.com/u/1875754?v=4)](https://github.com/itkg-jbrousseau "itkg-jbrousseau (32 commits)")[![itkg-ahidri](https://avatars.githubusercontent.com/u/5949639?v=4)](https://github.com/itkg-ahidri "itkg-ahidri (6 commits)")[![jbrousseau](https://avatars.githubusercontent.com/u/6469974?v=4)](https://github.com/jbrousseau "jbrousseau (4 commits)")[![betd-sthibault](https://avatars.githubusercontent.com/u/8640324?v=4)](https://github.com/betd-sthibault "betd-sthibault (3 commits)")[![itkg-abeauvain](https://avatars.githubusercontent.com/u/1875790?v=4)](https://github.com/itkg-abeauvain "itkg-abeauvain (3 commits)")[![juchi](https://avatars.githubusercontent.com/u/3333098?v=4)](https://github.com/juchi "juchi (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

---

Tags

libraryinteraktingconsumeitkg

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/itkg-consumer/health.svg)

```
[![Health](https://phpackages.com/badges/itkg-consumer/health.svg)](https://phpackages.com/packages/itkg-consumer)
```

###  Alternatives

[league/iso3166

ISO 3166-1 PHP Library

69536.3M116](/packages/league-iso3166)[php-soap/ext-soap-engine

An ext-soap engine implementation

443.2M7](/packages/php-soap-ext-soap-engine)[dekor/php-array-table

PHP Library for printing associative arrays as text table (similar to mysql terminal console)

296.6M2](/packages/dekor-php-array-table)

PHPackages © 2026

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