PHP code example of titasgailius / laravel-stream-remote

1. Go to this page and download the library: Download titasgailius/laravel-stream-remote library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

titasgailius / laravel-stream-remote example snippets


return response()->streamRemoteDownload('https://example.com/remote/file.zip', 'archive.zip');

return response()->streamRemoteDownload('https://example.com/remote/file.zip', 'archive.zip', [
    'Content-Type' => 'application/zip'
], 'attachment', 1024);

public function streamRemoteDownload(
    string $url,
    string $name = null,
    array $headers = [],
    string $disposition = 'attachment',
    int $chunk = 2048
): StreamedResponse;