Closed roelvanduijnhoven closed 6 years ago
This is the intended behaviour currently. We could definitely add an async download method though — I'm open to it.
In the API Guidelines, we're more referring to the fact that we've found that it's best to call it async, but we didn't prescribe that in the library, because there are lots of ways to make an async call, like using workers or relying on the download call being made client-side.
Thanks @lukechesser
Gave it a go, but in the end this cannot be done properly using PHP. https://github.com/guzzle/guzzle/issues/1127
In the medium post I read:
However the download endpoint is not async. See: https://github.com/unsplash/unsplash-php/blob/master/src/Photo.php#L204. In fact: it has a return value. Thus if I would add this call; this would now indeed slow down the user experience a little bit.
Is the behaviour in this repo intended? I would suggest introducing a new method
asyncDownload
that does precisely that. We could use Guzzle's async mechanism: http://docs.guzzlephp.org/en/stable/faq.html#can-guzzle-send-asynchronous-requests.