https://github.com/reinfi/zf-guzzle-emitter
Zend Framework Module to register emitter to guzzle client via configuration
https://github.com/reinfi/zf-guzzle-emitter
emitter guzzlehttp subscriber zend-framework
Last synced: 7 months ago
JSON representation
Zend Framework Module to register emitter to guzzle client via configuration
- Host: GitHub
- URL: https://github.com/reinfi/zf-guzzle-emitter
- Owner: reinfi
- Created: 2017-08-29T19:03:35.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-08-29T20:07:14.000Z (almost 9 years ago)
- Last Synced: 2025-01-12T07:35:47.868Z (over 1 year ago)
- Topics: emitter, guzzlehttp, subscriber, zend-framework
- Language: PHP
- Size: 8.79 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/reinfi/zf-guzzle-emitter)
[](https://codeclimate.com/github/reinfi/zf-guzzle-emitter)
[](https://coveralls.io/github/reinfi/zf-guzzle-emitter?branch=master)
Configure guzzle emitter subscriber via configuration.
1. [Installation](#installation)
2. [Usage](#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:
```php
return [
'modules' => [
'Reinfi\GuzzleEmitter',
// other modules
],
];
```
### Usage
To use it you need to register your subscriber under the following config key.
```php
'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
```php
$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.