php-http / httplug

HTTPlug, the HTTP client abstraction for PHP
http://httplug.io
MIT License
2.57k stars 39 forks source link

Use Async Interop #119

Closed joelwurtz closed 7 years ago

joelwurtz commented 8 years ago
Q A
Bug? no
New Feature? yes

I think it's time to begin the work to use the standard defined by async-interop : https://github.com/async-interop.

Their are not stable, but it's, from what i have seen, in a testable state.

So I think this is better to give it a shot now, as we can give some input before it's done and make some adjustement to the spec if needed.

But before doing that :

joelwurtz commented 8 years ago

IMO, we should use this standard, people working on it are contributors of all majors async framework in the php world (amp, icicle, react and others), even if they are not going to be a PSR standard i think it will be the defacto reference to do async in PHP.

For the BC layer i want to propose to create a new package for async and deprecate the current interface and decide on a time for going to 2.0 (like 1 year) where we will remove this interface.

joelwurtz commented 7 years ago

begin to work on it on https://github.com/php-http/httplug-async

sagikazarmark commented 7 years ago

Sorry for not getting back earlier. I have been looking at the async-interop as well prior to our first HTTPlug release. Normally it would be okay for me to switch to a stable-enough interop project, even if it means a BC break on our side to use the PSR growing out of it (as we also did it ourselves), because it might take a lot of time to get there.

However, in our case async is used in plugins which makes me think whether we really want to break BC to use the async-interop and then break BC when the PSR is out.

The fact that major version let's us breaking BC does not mean we should do it.

Also, even if it's not going to be a PSR, I am not sure if async-interop is stable enough. Looking at the dependents of the composer packages: none of their authors use them in their packages.

dbu commented 7 years ago

i agree with mark, BC breaks are ok between major versions, but not a great thing even then.

imho we are in no hurry with this, lets see for a while how fast psr advances and how much adoption the interop thing gets and then re-discuss.

joelwurtz commented 7 years ago

imho we are in no hurry with this, lets see for a while how fast psr advances and how much adoption the interop thing gets and then re-discuss.

I updated the PR with last version.

In term of adoption, all major projects of async contribute on this spec, so it will be compatible with all library using async behavior then it sure will be adopted. Like php-http, adoption of this spec is not user related but more library related and this is already the case.

joelwurtz commented 7 years ago

In term of BC i didn't think too much on how we should handle this, my first goal is to achieve the wanted behavior with this new specification and then think about we switch from our old spec to this new one.

joelwurtz commented 7 years ago

closing this async interop is on hold