-
Notifications
You must be signed in to change notification settings - Fork 47
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
You cannot use the "Symfony\Component\HttpClient\Psr18Client" as the "psr/http-client" package is not installed #248
Comments
ok, took me a moment but i think this is a confusion between the psr client and the legacy php-http client abstraction. if you want psr-18, you don't need to require |
if you manually require psr/http-client, it will only work by chance because the symfony http client has adapters for both http client interfaces. |
Changing my requirements to use {
"config": {
"allow-plugins": {
"php-http/discovery": true
}
},
"require": {
"psr/http-client-implementation": "*",
"php-http/discovery": "^1.18"
}
} But, I was mistaken earlier when I said we did not directly rely on I'd like to understand better about "it will only work by chance" though, I'd much prefer it to work on purpose! :) |
php-http/client-implementation is the virtual package for the httplug interfaces by php-http. after we built that, we proposed psr-18, which is now accepted and defines an "official" http client interface. the virtual package for psr18 is psr/http-client-implementation. we did not deprecate httplug because it also provides an asynchronous client, and psr-18 is only about synchronous http requests. symfony/http-client provides both an integration with psr18 and with the legacy php-http client - this is why i said it would work by chance if you requries a php-http client implementation but then expect to find a psr18 client. all that said, i just ran your minimal composer.json and indeed psr/http-client is not installed automatically. i think this is indeed a mistake of discovery. i think #249 would be the fix. can you try with that branch if your project then indeed works? |
Confirmed as working using |
should be fixed in https://github.com/php-http/discovery/releases/tag/1.19.0 |
PHP version: 8.2.0
Description
php-http/discovery plugin installs a psr18 client that cannot be discovered
How to reproduce
composer.json:
test.php:
Results:
Possible Solution
As a workaround, I could require
psr/http-client
, but we don't directly require or use it.The text was updated successfully, but these errors were encountered: