Skip to content
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

feat: add factory for NoPrivateNetworkHttpClient #451

Closed

Conversation

KDederichs
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #450
Documentation if this is a new feature, link to pull request in https://github.com/php-http/documentation that adds relevant documentation
License MIT

What's in this PR?

Adds a factory for Symfony's NoPrivateNetworkHttpClient

Why?

While you can just wrap it yourself, it gets annoying when you're trying to inject other non Symfony clients in unit tests (mock client)

Example Usage

        webhook:
            http_methods_client: false
            factory: 'httplug.factory.symfony_no_private_network'

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
  • Documentation pull request created (if not simply a bugfix)

To Do

  • Please tell me if you're actually OK with something like this, if so I'll add it to the docs and changelog

@ostrolucky
Copy link
Collaborator

This should be a plugin instead IMO. We can't add factory for every "client" that symfony/http-client has, because they are using client implementations as a way of extending the functionality, for which httplug has concept of plugins instead

@KDederichs
Copy link
Contributor Author

Sure, plugin also sounds good.
I'll write one for myself then and if you think there's demand for that I'll PR it into php-http/client-common

@KDederichs KDederichs closed this Apr 24, 2024
@dbu
Copy link
Collaborator

dbu commented Apr 24, 2024

thanks for wanting to contribute. i agree that this would fit better in a plugin than as a specific client.

if you write a plugin that replicates the functionality, that would be interesting to have in php-http/client-common. it can not depend on the symfony client though.

if you write a plugin that leverages the symfony code, you could publish it in a separate repository and we can mention it in the plugin list.

btw, note that httplug bundle also allows you to specify a custom client service as http client if you want to instantiate a specific client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Factory for NoPrivateNetworkHttpClient
3 participants