-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Provide alternatives to getConfig() #3114
Comments
use Middleware and check if request headers has TokenId ? |
Thanks, it looks interesting: https://docs.guzzlephp.org/en/stable/handlers-and-middleware.html#middleware |
This is marked as deprecated, but probably I won't actually ever remove this. I just want to encourage people to not use it. |
I'm also using this Symfony package, like mentioned in the issue's description, and now I'm not sure how to push middleware to the existing client, currently I'm doing it like this:
With |
I see you've mentioned you'll probably never remove this but the issue is I'm using phpstan to draw the attention to problematic lines of code in my codebase. I can ignore these lines but would prefer to have them out of deprecation notice or have an alternative to it. It would be wonderful if it's part of your plan to do one of these. :) |
You can view this as technical debt in your code. We do not recommend using that function, but we appreciate many people do. |
Should it be asked and/or documented on the bundle repo? https://github.com/8p/EightPointsGuzzleBundle |
You would need to create the handler then construct a guzzle client with said handler. |
Much like in #3185. |
In Drupal, a Guzzle client can be injected. We need to know what its settings are so that we can create a client with our own settings based on that. I don't see a way around this. This is what we use |
What speaks against marking this function as |
Description
In #2516,
getConfig()
was deprecated, but no replacement was suggested.Example
We use https://packagist.org/packages/eightpoints/guzzle-bundle to use Guzzle in a Symfony project, with this config:
The method that use Guzzle can return
null
early if no key is provided for this client, so that we can enable or disable the calls to the external API by changing the value of%example_api_key%
in our different environments.If
getConfig()
is removed in Guzzle 8, we won't be able to access to the config and disable these calls.We could pass
%example_api_key%
to do the same thing but I think that it would be nice to rely only on the$client
that already contain this value.Additional context
Idea: add
getHeaders()
or something likegetHeader('TokenID')
, etc. to allow to access to the values that are accessible throughgetConfig()
today with Guzzle 7.See also #2514
The text was updated successfully, but these errors were encountered: