-
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
Add a base interface for Middleware classes #232
Comments
Generally middlewares don't have any interfaces and we can implement one for out 5 middlewares, but what to do with all other from packagist: https://packagist.org/?query=guzzle%20middleware |
I respectfully disagree. As for the last part, sorry but I don't follow... The only weird thing here is that within the same bundle different method names are used for things that essentially do the same thing : add a middleware closure to the stack... Anyhow if this is not something you'd want to have... we can close this issue. |
I agree with you, that all middlewares in bundle should follow the same style and I think the better result would be to use function foo(BarInterface $bar) { } But we don't have any places to use it in this way. Do you see any other cases where interface will help us? |
Unless we create a "proxy" method to register a middleware in the handler stack then no I don't think there's currently any use case like dependency injection. |
Loooking at the current state of the Middleware classes in the bundle, I see that each Middleware class uses a different method name to return the
\Closure
to be used.Don't you think it would be best to have a MiddlewareInterface to have something that's always similar ?
To be honest I'm not sure what to use for the name of the method that would return the Closure.
But currently depending on which middleware we have : profile, log, __invoke, and so on.
Note: if you're ok with the idea I can add this.
The text was updated successfully, but these errors were encountered: