j0k3r / graby

Graby helps you extract article content from web pages
MIT License
368 stars 73 forks source link

Add async support #323

Open jtojnar opened 1 year ago

jtojnar commented 1 year ago

Unfortunately, it currently does not work because HttpFulfilledPromise is broken (does not allow to be converted to another promise type).

jtojnar commented 1 year ago

I guess we could introduce a dependency on a concrete promise library such as https://github.com/reactphp/promise/tree/2.x

j0k3r commented 1 year ago

I never worked on async/promise on PHP so I might not be able to properly review it. But will it force people to use async/promise or will they still be able to use the sync way like before?

jtojnar commented 1 year ago

We can provide sync api by just calling wait() on the promise (that is what HttpClient::fetch() does.

jtojnar commented 1 year ago

Tests depend on https://github.com/j0k3r/httplug-ssrf-plugin/pull/10

jtojnar commented 1 year ago

Will want to finish https://github.com/j0k3r/graby/pull/324 first, since that way conflicts are easier to resolve.