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

"Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead." #244

Open
signe opened this issue May 24, 2023 · 6 comments

Comments

@signe
Copy link

signe commented May 24, 2023

php-http/message-factory has been deprecated and should be removed.

Additionally, the instructions to add

    "discovery": {
      "psr/http-factory-implementation": "GuzzleHttp\\Psr7\\HttpFactory"
    }

Do not prevent discovery from auto-requiring message-factory if composer plugins are enabled.

@dbu
Copy link
Contributor

dbu commented May 24, 2023

i am not sure i understand? PSR-17 is the newer standard, but php-http/message-factory is not the same as PSR-17. if a consumer requires php-http/message-factory, they need it to be installed even though it has been deprecated.

if the consumer only requires psr/http-factory-implementation but not php-http/message-factory we should not be installing php-http/message-factory.

what is the situation where you see and what would you expect to happen?

@signe
Copy link
Author

signe commented May 24, 2023

Apparently this was a chain of includes that ended with symfony/http-client, which triggered discovery to force the message-factory requirement. Since there is no output for why the requirement is being triggered, it was totally unclear and I could only see it happening when discovery was enabled in composer's allow-plugins

symfony/http-client v5.4.23 Provides powerful methods to fetch HTTP resources synchronously or asynchronously
└──async-aws/core 1.18.1 (requires symfony/http-client ^4.4.16 || ^5.1.7,!=5.2.0 || ^6.0)
   └──async-aws/ses 1.5.0 (requires async-aws/core ^1.9)
      └──symfony/amazon-mailer v5.4.23 (requires async-aws/ses ^1.0)

composer why just said that my root package was the dependency, which wasn't true... but makes sense now.

Is it possible for Composer/Plugin.php to output a message indicating what it is that's requiring packages?

@dbu
Copy link
Contributor

dbu commented May 25, 2023

hm, the symfony http client in version 5.4 does require php-http/message-factory, but only as a develop dependency

maybe @nicolas-grekas has an idea why this is being installed and if its correct that php-http/messsage-factory is installed?

that said, if this no longer happens with symfony 6, it is probably okay. the factories have been deprecated, but we won't remove the repository, so your code will continue working.

@BadJacky
Copy link

BadJacky commented Aug 3, 2023

Although the php-http/message-factory as the require-dev for symfony/http-client v5.4-6.2.x, but actually it is a required package! the nyholm/psr7removed the php-http/message-factory since v1.6, you have to install the php-http/message-factory if you want the symfony/http-client work well.
so it is a require instead of a required-dev

@nicolas-grekas
Copy link
Collaborator

You need to install it in your own deps yes, because you're using an optional feature of symfony/http-client.

@nicolas-grekas
Copy link
Collaborator

php-http/message-factory is required when using HttplugClient from symfony/http-client before version 6.3. Since v6.3, you can use HttplugClient without installing php-http/message-factory.

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

No branches or pull requests

4 participants