-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins #21
Comments
Added handler stack as a service so you can now add your own middlewares/plugins. "repositories": [
{
"url": "https://github.com/florianpreusner/GuzzleBundle.git",
"type": "git"
}
],
"require": {
"eightpoints/guzzle-bundle": "dev-master"
} After getting this version you should be able to get the guzzle handler stack by the container and add your own middlewares: $stack = $this->get('guzzle.handler_stack.NAME_OF_CLIENT_BY_CONFIG');
$stack->push($callable); Please check if that fits your request. If so I can integrate this change and also provide a documentation. Best regards |
I have a patch I've written that actually dispatches an event. Sent from my iPhone
|
Can you share some more information cause your idea to be able to push middlewares to the handler stack seems to be interesting for others also. |
@florianpreusner That pull request is the enhancement I spoke of. Chris Warner |
I see. Great! Thanks for your contribution, your PR is merged. |
Hello, I try to add some middleware in my guzzle client, but your service id for handler doesn't exist anymore. And if I see your code your system that create handler is totally static we can't add handler ? |
I can't seem to find a way to addl handlers, plugins, Middleware or even add additional events to the guzzle package. I have a use-case where in I need to be able to change an authentication header, and I'd like to provide a plugin that can handle the work. However; I don't see how to make it work currently.
My initial thought was to try and add the plugin but I don't see how that is loaded. Then I tried to add it through a compiler pass; but since I don't have access to the options being set on the client I can't do that. My second thought was to create a handler on the guzzle stack, that would emit events, and then bind to handlers/listeners using tags.
Would this be something you where interested in?
The text was updated successfully, but these errors were encountered: