-
-
Notifications
You must be signed in to change notification settings - Fork 338
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
Replace HttpClient with PSR-18 HTTP Client #975
Conversation
May I suggest that you change the prefix of relevant option names from |
Actually I'm considering re-adding the interfaces and classes that wads removed, and keeping the current config names. I'm trying to minimise breaking changes for V2, so that all external plugins and gateways can work fine with both V1 and V2, and a lot of them uses the current |
Hmm, not sure I'm a fan of the idea. It's not often that you're releasing a new major version. IMO, cleaning up as much as possible while doing so would make sense, unless Payum were willing to commit to some soft of a predictable major release schedule (like Symfony and PHP itself). |
There are hundreds of custom gateways available that might not all get updated to support V2, so releasing a new major version with no compatible gateways (except the built-in ones) and having slow adoption does not sound like a good strategy. I want people to be able to upgrade to Payum V2 and get access to some of the new features and cleaner code, without having to wait for their gateways to get updated, otherwise most people will just stay on V1
Just because a new major version is released, doesn't mean you need to take that chance and break as much as possible for everyone. A lot of clean up can still happen while still keeping existing functionality and gateways working. It does not make sense for me to release a new major version that would hardly be usable in most applications without a lot of extra effort, or not being able to use any existing payment gateways because the author doesn't update it soon enough |
I get your point. I guess, as a fan of semver, I just have that habit of associating major releases with API breakage and not seeing it as a bad thing. But if you intend to keep the old API intact, I just don't see much of a point to call this next release 2.0, I guess, because I see it more as an incremental change (1.x) than something big. Of course, I don't know what else is changing and how, but assuming that your intention is to keep the work required to migrate at zero, it still seems like a minor release to me. :) On the other hand, you yourself said in #954:
and I agree with this quote wholeheartedly. I think that not providing its own HTTP client could potentially make Payum a bit easier to work with and a bit cleaner code-wise. It would allow to drop some classes and interfaces entirely, and clean up at least one other place ( |
According to Semver, when releasing a new major version, you CAN break BC, not that you MUST break BC.
There are a lot of changes planned for 2.0, so I want to release it as a new major version with a lot of overhaul and new features, which warrants a new major version. Nobody will be excited about a 1.8 release :)
And I still stand with this 100%, just not for the next release. The migration path to 2.0 should be as smooth as possible, then we can start working on more breaking changes for 3.0. Anyway, let's move this discussion to https://github.com/orgs/Payum/discussions/977 and keep the discussion on this PR related to the changes. |
I have made the following changes to the PR:
These changes allows a gateway to be compatible with both Payum 1 and 2, but will trigger deprecations on Payum 2. |
Fixes #954
httplug.message_factory
config option is deprecated. Usepayum.http_message_factory
insteadhttplug.stream_factory
config option is deprecated. Usepayum.http_stream_factory
insteadhttplug.client
is deprecated. Usepayum.http_client
insteadPayum\Core\Bridge\Httplug\HttplugClient::send
method is deprecated and will be removed in 3.0. UsePayum\Core\Bridge\Httplug\HttplugClient::sendRequest
insteadPayum\Core\Bridge\Httplug\HttplugClient
is deprecated and will be removed in 3.0. Use PSR-18 HTTP Client insteadpayum.http_client
config option will return an instance ofPsr\Http\Client\ClientInterface
in a future version.Payum\Core\HttpClientInterface
orPayum\Core\Bridge\Httplug\HttplugClient
toPsr\Http\Client\ClientInterface