reinfi / zf-guzzle-emitter
A Zend Framework module adding subscribers to guzzle emitter via configuration.
1.0.0
2017-08-29 19:57 UTC
Requires
- php: >=7.0
- guzzlehttp/guzzle: ^5.3
- zendframework/zend-modulemanager: ~2.7
Requires (Dev)
- phpunit/phpcov: ^3.0
- phpunit/phpunit: ^5.7
- satooshi/php-coveralls: ^1.0
- zendframework/zend-mvc: ~2.7
- zendframework/zend-servicemanager: ~2.7
This package is auto-updated.
Last update: 2024-11-10 06:12:21 UTC
README
Configure guzzle emitter subscriber via configuration.
Installation
- Install with Composer:
composer require reinfi/zf-guzzle-emitter
. - Enable the module via ZF2 config in
appliation.config.php
undermodules
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.