Kong / unirest-php

Unirest in PHP: Simplified, lightweight HTTP client library.

Home Page:http://unirest.io/php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asynchronous requests

subnetmarco opened this issue · comments

I would really like to add asynchronous request support to Unirest-PHP, so that it can match the feature set of the other Unirest libraries (http://unirest.io).

PHP doesn't natively support threads, and it doesn't seem to be a standard practice for achieving this. I would like to encourage a discussion to share some ideas for a possible async implementation.

Curl has multi async right? I'm sure some of the other libraries also have them too.

I built an async curl multi request client a couple of years ago, i'll put down few rows of raw code as soon as i found it.

Oh, i forgot to mention this work about fsocket-async: Multiplexing. The curl approach is totally similar.

Definitely looking forward for async support!

Unirest-PHP is really cool!

Unirest really needs this feature to be useful to PHP devs

https://github.com/jmathai/php-multi-curl
https://github.com/petewarden/ParallelCurl

An interesting read that argues for socket reuse rather than forking curl processes: https://segment.io/blog/how-to-make-async-requests-in-php/

It's not universal, and I'm not even sure if it works (last time I tried to compile it, it didn't work), but I would really love to see pthreads worked on and finished. With the new standardized threads in C++11, I would think it'd be possible now.

here is new php framework which is async.I think this will be help full http://reactphp.org/

While not native, hhvm has basic support that could be used. http://docs.hhvm.com/manual/en/hack.async.php

closing this, until a PR is made.