Skip to content

Custom Downloader to allow for people running Laravel Vapor to suppor… - #20285

Open
bretto36 wants to merge 1 commit into
filamentphp:4.xfrom
bretto36:4.x-custom-downloader
Open

Custom Downloader to allow for people running Laravel Vapor to suppor…#20285
bretto36 wants to merge 1 commit into
filamentphp:4.xfrom
bretto36:4.x-custom-downloader

Conversation

@bretto36

Copy link
Copy Markdown
Contributor

…t downloading of files

Description

Allow the ability to customise the Downloader for an export action. I use Laravel Vapor, and large files get blocked by the Load Balancer/Lambda/API Gateway - https://docs.vapor.build/projects/development#binary-responses - Streamed responses don't seem to work for larger files.

This allows someone to specify a new downloader on their Export - I am planning on making a Filament Plugin for this so that people can simply use a Trait from the package.

I'd like your thoughts on the viability of this. Best case scenario is changing the existing system to automatically recognise Vapor and return a redirect to an S3 url instead of trying to stream it. But the last PR for that seemed to go no where. I figured this extends the system so that people can do whatever they want. Perhaps people could stream it if it's below a threshold or upload and return the s3 url if not.

Visual changes

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.


echo $disk->get($file);
return response()->streamDownload(function () use ($export): void {
foreach (app(CsvExportContent::class)($export) as $chunk) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the creation of the content to a separate class so that someone can extend the CSVDownloader/XsxDownloader and only override the invoke method, without having to touch the actual creation of the rows

return [ExportFormat::Csv, ExportFormat::Xlsx];
}

public static function getDownloader(ExportFormatInterface $format): Downloader

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows someone to specify their own downloader depending on the Formatter used

@danharrin danharrin added enhancement New feature or request pending review labels Jul 27, 2026
@danharrin danharrin added this to the v4 milestone Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request pending review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants