Skip to content
This repository was archived by the owner on May 13, 2023. It is now read-only.

Add PSR-17 compatibility layer #38

Closed
wants to merge 1 commit into from
Closed

Add PSR-17 compatibility layer #38

wants to merge 1 commit into from

Conversation

sagikazarmark
Copy link
Member

@sagikazarmark sagikazarmark commented Dec 6, 2018

This PR adds a compatibility layer between our message factories and PSR-17. Once it is in place, we can refactor the discovery layer to check for PSR-17 implementations and use them instead of requiring the php-http/message package.

After that we can deprecate the implementations of our message factories and the interfaces themselves, eventually migrating to PSR-17 interfaces. Maybe we can do it before tagging client-common 2.0?

Todo

  • Add tests (anyone up for it?)

Copy link
Contributor

@dbu dbu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this allows to use PSR-17 implementations in code that is still using the HTTPlug interfaces. that can help migrations, so i approve.

do we deprecate the httplug factories in version 2 but keep them for now?

and do we want to rewrite discovery to be a psr-17 discovery? that is quite a change, as it will return a different interface.

*
* @author Márk Sági-Kazár <mark.sagikazar@gmail.com>
*/
final class MessageFactory implements \Http\Message\MessageFactory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i usually use such a thing and specify an alias like BaseMessageFactory, or in this case maybe LegacyMessageFactory?

/**
* {@inheritdoc}
*/
public function createRequest($method, $uri, array $headers = [], $body = null, $protocolVersion = '1.1')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so this is where PSR-17 and HTTPlug differ, right?

@silvadanilo
Copy link

silvadanilo commented Mar 12, 2019

Hi,
is the merge of this pull request planned?

@dbu
Copy link
Contributor

dbu commented Dec 17, 2019

when this is released, update the changes from php-http/cache-plugin#56

@sagikazarmark
Copy link
Member Author

Sorry, totally forgot about it. Will try to pick this up soon.

@Infernal15
Copy link

Hi, is the merge of this pull request planned?

@dbu
Copy link
Contributor

dbu commented Dec 4, 2022

not sure how useful this is anymore, there are a bunch of factory implementations available. the most popular being guzzlehttp/psr7 and nyholm/psr7, see https://packagist.org/providers/psr/http-factory-implementation for the full list of implementations.

and php-http/discovery has support for the guzzlehttp and nyholm factories.

is there any need to provide a psr 17 implemenation on top of our own factories? /cc @Nyholm

@dbu
Copy link
Contributor

dbu commented Apr 14, 2023

closing this in favor of #42 - we will deprecate this whole repository and point people to the PSR-17 factories.

@dbu dbu closed this Apr 14, 2023
@dbu dbu deleted the psr17 branch April 14, 2023 14:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants