Zend Framework Module to register emitter to guzzle client via configuration
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
src
test
.gitignore
.travis.yml
README.md
composer.json
phpunit.xml

README.md

Build Status Code Climate Coverage Status

Configure guzzle emitter subscriber via configuration.

  1. Installation
  2. Usage

Installation

  1. Install with Composer: composer require reinfi/zf-guzzle-emitter.
  2. Enable the module via ZF2 config in appliation.config.php under modules key:
    return [
        'modules' => [
            'Reinfi\GuzzleEmitter',
            // other modules
        ],
    ];

Usage

To use it you need to register your subscriber under the following config key.

'guzzle_emitter' => [
    'subscriber' => [
        YourSubscriber::class,
    ],
]

All your subscribers must be registered within the service locator.

When you need to get a new guzzle client you just pass the following options

$options = [
    'emitter' => $container->get(\Reinfi\GuzzleEmitter\Emitter::class);,
    '...'     => '',
];

$client = new Client($options);

For information how to write subscriber see http://docs.guzzlephp.org/en/5.3/events.html#event-subscribers

FAQ

Feel free to ask any questions or open own pull requests.