#development #laravel #php

If you want to stream a HTTP download to a file when using the Laravel HTTP client, you can do this:

1$resource = \GuzzleHttp\Psr7\Utils::tryFopen('/path/to/file', 'w');
2
3Http::withOptions(['sink' => $resource])->get('url');

You can read more about the sink option in the Guzzle documentation.