PHPackages                             mulertech/file-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. mulertech/file-bundle

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

mulertech/file-bundle
=====================

Symfony bundle for file upload management with metadata tracking, configurable validation, and extensible entity

v1.1.0(1mo ago)098MITPHPPHP ^8.4CI passing

Since Apr 4Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mulertech/file-bundle)[ Packagist](https://packagist.org/packages/mulertech/file-bundle)[ RSS](/packages/mulertech-file-bundle/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (30)Versions (3)Used By (0)

MulerTech File Bundle
=====================

[](#mulertech-file-bundle)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/02a55a544b02fe7a6ab84920fab26c4a8ca1d9ba3dc8309cca0935a3f737a6f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d756c6572746563682f66696c652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/file-bundle)[![GitHub Tests Action Status](https://camo.githubusercontent.com/4666c569562adf4931caaf378ba9c22b75f723fc34fc822e50919720b9587346/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f66696c652d62756e646c652f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mulertech/file-bundle/actions/workflows/tests.yml)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/7048c9cc836d7e0434de59a6f55253a274ee3066e338e4212f0c876f8b98d2c7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f66696c652d62756e646c652f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/mulertech/file-bundle/actions/workflows/phpstan.yml)[![Total Downloads](https://camo.githubusercontent.com/ce42b326ac65755c411c3cb4001d37d5c891fe05f0a7d0cbe7b29cfa307e8524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d756c6572746563682f66696c652d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/file-bundle)[![Test Coverage](https://raw.githubusercontent.com/mulertech/file-bundle/badge/badge-coverage.svg)](https://packagist.org/packages/mulertech/file-bundle)

---

Symfony bundle for file upload management with metadata tracking, configurable validation, and an extensible entity.

Requirements
------------

[](#requirements)

- PHP 8.4+
- Symfony 6.4+, 7.0+ or 8.0+
- Doctrine ORM 2.19+ or 3.0+

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

[](#installation)

```
composer require mulertech/file-bundle
```

Configuration
-------------

[](#configuration)

```
# config/packages/mulertech_file.yaml
mulertech_file:
    storage_directory: '%kernel.project_dir%/var/documents'
    file_class: App\Entity\File
    # max_file_size: 52428800  # 50MB (default)
    # directory_strategy: null  # Service ID for custom DirectoryStrategyInterface
    # allowed_mime_types:       # Override default MIME types
    #     - 'application/pdf'
    #     - 'image/jpeg'
```

Usage
-----

[](#usage)

### 1. Create your File entity

[](#1-create-your-file-entity)

Extend the provided `AbstractFile` MappedSuperclass:

```
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use MulerTech\FileBundle\Entity\AbstractFile;

#[ORM\Entity]
#[ORM\Table(name: 'files')]
class File extends AbstractFile
{
    #[ORM\ManyToOne]
    #[ORM\JoinColumn(nullable: false)]
    private User $uploadedBy;

    // Add your own relations and fields...
}
```

### 2. Implement FileUploaderInterface

[](#2-implement-fileuploaderinterface)

Your User entity must implement `FileUploaderInterface`:

```
use MulerTech\FileBundle\Model\FileUploaderInterface;

class User implements FileUploaderInterface
{
    public function getId(): ?int { /* ... */ }
}
```

### 3. Upload files

[](#3-upload-files)

Inject `FileManagerInterface` in your controller or service:

```
use MulerTech\FileBundle\Service\FileManagerInterface;

class FileController
{
    public function upload(FileManagerInterface $fileManager, Request $request): Response
    {
        $uploadedFile = $request->files->get('file');
        $file = $fileManager->upload($uploadedFile, $user);

        // $file is your concrete entity, persisted and flushed
    }
}
```

### 4. Custom directory strategy (optional)

[](#4-custom-directory-strategy-optional)

Implement `DirectoryStrategyInterface` to control where files are stored:

```
use MulerTech\FileBundle\Storage\DirectoryStrategyInterface;
use MulerTech\FileBundle\Model\FileUploaderInterface;

class ProjectDirectoryStrategy implements DirectoryStrategyInterface
{
    public function getRelativeDirectory(FileUploaderInterface $uploader, ?object $context = null): string
    {
        if ($context instanceof Project) {
            return sprintf('project_%d', $context->getId());
        }

        return sprintf('user_%d', $uploader->getId());
    }
}
```

Then configure:

```
mulertech_file:
    directory_strategy: App\Storage\ProjectDirectoryStrategy
```

### 5. Twig functions

[](#5-twig-functions)

```
{% if file_exists_on_disk(file) %}
    {{ format_file_size(file.size) }}
{% endif %}
```

Testing
-------

[](#testing)

```
./vendor/bin/mtdocker test-ai
```

License
-------

[](#license)

MIT

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance94

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 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 ~60 days

Total

2

Last Release

30d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/57788787?v=4)[Sébastien Muler](/maintainers/mulertech)[@mulertech](https://github.com/mulertech)

---

Top Contributors

[![mulertech](https://avatars.githubusercontent.com/u/57788787?v=4)](https://github.com/mulertech "mulertech (10 commits)")

---

Tags

phpsymfonymetadatafilestorageuploadfile management

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M387](/packages/easycorp-easyadmin-bundle)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[sulu/sulu

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

1.3k1.4M203](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)

PHPackages © 2026

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