snnick/laravel-file-downloader

Laravel package for file download

Installs: 46

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/snnick/laravel-file-downloader

dev-master 2022-09-14 07:24 UTC

This package is auto-updated.

Last update: 2025-09-16 15:56:28 UTC


README

Run the following command to install the latest applicable version of the package:

composer require snnick/laravel-file-downloader

After installation, you can publish the package configuration using the vendor:publish command. This command will publish the file-downloader.php configuration file to your config directory:

php artisan vendor:publish --provider="Snnick\LaravelFileDownloader\LaravelFileDownloaderServiceProvider"

You may configure the file path in your .env file:

FILE_DOWNLOAD_PATH=app/public/files

Download

You can download files:

$strategy = new PdfDownloader(
            'pdf.invoices',
            'invoices',
            ['calculations' => new CalculationsDTO($calculations)]
        );
$service = new FileDownloaderService($strategy);
$filepath = $service->download();