Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Download Bundle

Download Bundle Laravel Package

shegroup/download-bundle

A Symfony bundle for handling file downloads: serve files through controllers with configurable response headers, access control, and clean routing, so downloads stay secure, consistent, and easy to maintain across your application.

View on GitHub
Deep Wiki
Context7

This bundle allows you to download a database and folders associated with the project from remote host to local machine. It is the easiest and easiest way to have the same production data in your development environment.

Frequently asked questions about Download Bundle
How do I install shegroup/download-bundle with Composer?
Install it with composer require shegroup/download-bundle. If you are not using Symfony Flex, enable the bundle in your config/bundles.php so its services and DI configuration are registered. After that, import the bundle routing if you plan to use the provided download controllers. Check the repository README for the exact namespace and any required configuration keys.
Does this package work with Laravel?
No. Shegroup Download Bundle is a Symfony bundle built on Symfony's DependencyInjection, Routing, and HttpFoundation components, so it will not run inside a Laravel application. In Laravel you would use the framework's own response()->download() or response()->streamDownload() helpers instead. Use this package only in Symfony projects where its services and controllers can be autowired.
Which Symfony versions does this bundle support?
Version support is defined by the require constraints in the package's composer.json, so check that file and the tagged releases before upgrading a major Symfony version. Because the bundle is built on standard HttpFoundation and Routing features, it is generally portable across recent Symfony releases. Always run your functional tests after a framework upgrade to confirm the download endpoints still behave correctly.
How do I create a download route with this bundle?
The bundle ships reusable controllers and services that you wire into your application's routing configuration. You typically expose a route that points at the bundle controller (or your own thin controller that delegates to the download service), passing the file identifier as a route parameter. Review the README for the exact route names, defaults, and required parameters before enabling it in production.
How does the bundle prevent directory traversal attacks?
It resolves requested file paths securely rather than concatenating user input directly onto a base directory. Paths are normalized and validated against the allowed location so sequences such as ../ cannot escape the intended folder. As defence in depth, also restrict downloads to a dedicated directory and avoid passing raw request parameters straight into file system functions.
Can it serve large files without exhausting PHP memory?
Yes. The bundle uses streamed responses, which flush the file to the client in chunks instead of loading the whole file into memory with functions like file_get_contents. This keeps memory usage stable even for multi-gigabyte downloads. For very high traffic, consider offloading delivery to Nginx via X-Accel-Redirect and using the bundle mainly for authorization and header handling.
How do I configure Content-Type, Content-Disposition, and caching headers?
The bundle exposes configurable response headers for content type, disposition, and caching behaviour, set through its service or DI configuration. Use attachment disposition with a filename when you want a Save As dialog, or inline for browser previews. Set appropriate Cache-Control and Expires values for files that rarely change, and avoid long-lived public caching for private or authenticated downloads.
How do I restrict who can download a file?
Access control lives in your application: protect the download route with Symfony Security firewalls, access_control rules, or an isGranted check in a thin controller that then calls the bundle's download service. Keep authorization checks before the stream is started, since headers cannot be changed once output begins. Never rely on unguessable file names alone as your only protection.
How do I test download responses in PHPUnit?
Use Symfony's KernelBrowser or WebTestCase to request the download route and assert the status code, Content-Type, Content-Disposition, and Content-Length headers. For streamed responses, call the content callback rather than inspecting getContent() directly, or assert against the response object's header bag. Also add a negative test confirming that unauthorised users and traversal attempts return a 403 or 404 instead of a file.
What are the alternatives to using a download bundle in Symfony?
You can return BinaryFileResponse or StreamedResponse directly from a controller for simple cases, which requires no extra dependency. For larger applications, a filesystem abstraction such as Flysystem plus a custom controller gives you storage flexibility, and X-Sendfile or X-Accel-Redirect offloads the actual transfer to your web server. This bundle mainly helps when you want reusable, consistent download logic shared across several Symfony projects without rewriting boilerplate.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource