-
-
Notifications
You must be signed in to change notification settings - Fork 492
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
Allows to change the HTTP client in the factory #65
Conversation
5388fb2
to
f05e9bc
Compare
composer.json
Outdated
@@ -11,9 +11,10 @@ | |||
], | |||
"require": { | |||
"php": "^8.1.0", | |||
"guzzlehttp/guzzle": "^7.5.0" | |||
"psr/http-client-implementation": "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose to require psr/http-client-implementation
instead of a specific implementation. So that it is not necessary to exclude guzzle from projects that want to use an other implementation.
For the Laravel package, guzzle can be explicitly required to keep a smooth installation path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should also require "php-http/discovery": "^1.15"
so that such an implementation is installed automatically (+ the plugin should be disabled as such since we don't need it in for testing this:
"config": {
"allow-plugins": {
"php-http/discovery": false
}
},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, and this now misses require guzzlehttp/psr7
explicitly since it was a transitive deps but isn't anymore (expect in dev)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If guzzle is required by the laravel package, can we skip the composer plugin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then the plugin will do nothing 🤷 if you fear composer asking for enabling the plugin, it's already whitelisted by both laravel and symfony, and it's anyway still better than composer failing to install because of a missing implementation package.
But you might prefer going with ^1.14
so that this doesn't conflict with sentry when it's installed.
5d4a0fa
to
3305f54
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your review @nicolas-grekas. I hope maintainers will like this framework-agnostic implementation.
3305f54
to
004e784
Compare
004e784
to
b1e9d7b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM on my side thanks.
Completed in #75 Thanks to @nicolas-grekas @GromNaN for your help and your valuable feedback! |
Symfony integration would be complete if the
symfony/http-client
could be used. Instead of duplicating theOpenAI::client()
factory, I think it is more simple to allow a custom instance ofPsr\Http\Client\ClientInterface
. The Symfony PSR-18 client would be used.