2017 © Pedro Peláez
 

library consumer

Itkg consume library

image

itkg/consumer

Itkg consume library

  • Wednesday, April 26, 2017
  • by Interakting
  • Repository
  • 29 Watchers
  • 2 Stars
  • 20,971 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 12 Versions
  • 3 % Grown

The README.md

Webservice consumer library

Build Status Scrutinizer Code Quality Code Coverage SensioLabsInsight, (*1)

features

  • Rest & Soap consumer library
  • Webservice caching
  • Logging
  • OAuth management

Installation

Installation by Composer

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

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

Usage

Simple example of Rest WS, (*3)


$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

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

  • 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 & 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

  • Add Cache listener to your event dispatcher

$eventDispatcher->addSubscriber( new \Itkg\Consumer\Listener\CacheListener($eventDispatcher) );
  • Add cache adapter to your service (see : https://github.com/itkg/core 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 & deserialize method by defining 'cache_serializer' & 'cache_deserializer' options

The Versions

26/04 2017

dev-master

9999999-dev http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

30/01 2017

dev-fix_array_filter

dev-fix_array_filter http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

01/09 2016
09/08 2016
27/07 2015

dev-consumer

dev-consumer http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

23/06 2015

dev-1.0-no-solr-ldap

dev-1.0-no-solr-ldap http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

23/06 2015

0.9

0.9.0.0 http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

12/06 2015

1.0.x-dev

1.0.9999999.9999999-dev http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

12/06 2015

1.0.2

1.0.2.0 http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

12/06 2015

dev-pdenis-patch-1

dev-pdenis-patch-1 http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

10/09 2014

1.0.1

1.0.1.0 http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg

07/02 2014

1.0.0

1.0.0.0 http://github.com/itkg/consumer

Itkg consume library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar Interakting

library consume interakting itkg