PHPackages                             nzo/file-downloader-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. nzo/file-downloader-bundle

ActiveSymfony-bundle[File &amp; Storage](/categories/file-storage)

nzo/file-downloader-bundle
==========================

The NzoFileDownloaderBundle is a Symfony Bundle used to Download all types of files from servers and Web applications safely and with ease. You can also read/show the file content in the Web Browser.

v4.3.0(1y ago)919.9k↓63.1%1MITPHPPHP &gt;=7.1.3CI failing

Since Jan 30Pushed 1y ago3 watchersCompare

[ Source](https://github.com/NAYZO/NzoFileDownloaderBundle)[ Packagist](https://packagist.org/packages/nzo/file-downloader-bundle)[ RSS](/packages/nzo-file-downloader-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (16)Used By (0)

NzoFileDownloaderBundle
=======================

[](#nzofiledownloaderbundle)

[![tests](https://github.com/nayzo/NzoFileDownloaderBundle/actions/workflows/tests.yaml/badge.svg)](https://github.com/nayzo/NzoFileDownloaderBundle/actions/workflows/tests.yaml)[![Total Downloads](https://camo.githubusercontent.com/b9190598aabec96d1b4919bd377230fb91fb80ceec8c2a6c05cff6d478143f04/68747470733a2f2f706f7365722e707567782e6f72672f6e7a6f2f66696c652d646f776e6c6f616465722d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/nzo/file-downloader-bundle)[![Latest Stable Version](https://camo.githubusercontent.com/bd0821fdefbd2d30b73c159e98406acaa0edceb1ea0ca202ed500a31f4908d09/68747470733a2f2f706f7365722e707567782e6f72672f6e7a6f2f66696c652d646f776e6c6f616465722d62756e646c652f762f737461626c65)](https://packagist.org/packages/nzo/file-downloader-bundle)

The **NzoFileDownloaderBundle** is a Symfony Bundle used to `Download` all types of `files` from `servers` and `Web application projects` safely and with ease. You can also `read/show` the file content in the Web Browser.

Features include:

- This version of the bundle is compatible with Symfony &gt;= v4.4
- `Read/Show` the file content in the Web **Browser**.
- `Download` all types of `files` from the Symfony `public` folder or from a custom path.
- Change the name of the file when downloading.
- Download Files From Url
- Get Files Extension From Url

Installation
------------

[](#installation)

### Through Composer:

[](#through-composer)

```
$ composer require nzo/file-downloader-bundle
```

#### Register the bundle in config/bundles.php (without Flex)

[](#register-the-bundle-in-configbundlesphp-without-flex)

```
// config/bundles.php

return [
    // ...
    Nzo\FileDownloaderBundle\NzoFileDownloaderBundle::class => ['all' => true],
];
```

Usage
-----

[](#usage)

#### Read / Show the file content in the Web Browser:

[](#read--show-the-file-content-in-the-web-browser)

```
use Nzo\FileDownloaderBundle\FileDownloader\FileDownloader;

class MyController extends AbstractController
{
    private $fileDownloader;

    public function __construct(FileDownloader $fileDownloader)
    {
        $this->fileDownloader = $fileDownloader;

        // without autowiring use: $this->get('nzo_file_downloader')
    }

// In this examples the "myfile.pdf" file exist in "public/myfolder/myfile.pdf".

     public function readFilesFromPublicFolder()
     {
          return $this->fileDownloader->readFile('myfolder/myfile.pdf');
     }

     // Absolute PATH:

     public function readFilesFromAbsolutePath()
      {
           return $this->fileDownloader->readFileFromAbsolutePath('/home/user/myfile.pdf');
      }
}
```

#### Download the Files:

[](#download-the-files)

```
     public function downloadFileFromPublicFolder()
     {
          return $this->fileDownloader->downloadFile('myfolder/myfile.pdf');

        # change the name of the file when downloading:

          return $this->fileDownloader->downloadFile('myfolder/myfile.pdf', 'newName.pdf');
     }

     // Absolute PATH:

     public function downloadFilesFromAbsolutePath()
      {
           return $this->fileDownloader->downloadFileFromAbsolutePath('/home/user/myfile.pdf');

         # change the name of the file when downloading:

           return $this->fileDownloader->downloadFileFromAbsolutePath('/home/user/myfile.pdf', 'newName.pdf');
      }
}
```

##### Download Files from **URL**:

[](#download-files-from-url)

```
    public function downloadFileFromUrl(string $url, string $pathWhereToDownloadTheFile, ?string $customUserAgent = null)
    {
        $headers = ['Authorization: Basic auth'];

        $response =  $this->fileDownloader->downloadFileFromUrl($url, $pathWhereToDownloadTheFile, $headers, /** You can pass an optional custom User-Agent as third argument ($customUserAgent) */);

        if (false !== $response) {
            // File downloaded successfully !
        } else {
            // Error occurred !
        }
    }
```

##### Get Files Extension From **URL**:

[](#get-files-extension-from-url)

```
public function getFileExtensionFromUrl(string $url)
{
    $fileExtension = $this->fileDownloader->getFileExtensionFromUrl($url);

    if (null === $fileExtension) {
        // Error occurred !
    }
}
```

##### Download a Symfony **StreamedResponse**:

[](#download-a-symfony-streamedresponse)

```
    use Symfony\Component\HttpFoundation\StreamedResponse;

    // ...

    public function downloadStreamedResponse()
    {
        $streamedResponse = new StreamedResponse();
        // ...

        $fileName = 'someFileName.csv';

        return $this->fileDownloader->downloadStreamedResponse($streamedResponse, $fileName);
    }
```

License
-------

[](#license)

This bundle is under the MIT license. See the complete license in the bundle:

See [Resources/doc/LICENSE](https://github.com/nayzo/NzoFileDownloaderBundle/blob/master/LICENSE)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~252 days

Recently: every ~358 days

Total

15

Last Release

633d ago

Major Versions

1.3 → 2.02016-04-27

2.2 → v3.0.02019-04-24

v3.1.0 → v4.0.02020-10-31

PHP version history (2 changes)1.0PHP &gt;=5.3.3

v4.0.0PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/43973d4c7b23026540ed9f2670200cbd664d7ae7c55126feb465e62ba7a2a86f?d=identicon)[nayzo](/maintainers/nayzo)

---

Top Contributors

[![nayzo](https://avatars.githubusercontent.com/u/1272883?v=4)](https://github.com/nayzo "nayzo (56 commits)")

---

Tags

symfonybundlebrowserfilereaduploaddownloaddownloadershow

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nzo-file-downloader-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nzo-file-downloader-bundle/health.svg)](https://phpackages.com/packages/nzo-file-downloader-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[artgris/filemanager-bundle

FileManager is a simple Multilingual File Manager Bundle for Symfony

186446.6k13](/packages/artgris-filemanager-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
