PHPackages                             zeglup/media-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. [Image &amp; Media](/categories/media)
4. /
5. zeglup/media-bundle

ActiveSymfony-bundle[Image &amp; Media](/categories/media)

zeglup/media-bundle
===================

Fork from Donjohn/MediaBundle, a simple media bundle inspired by sonata media bundle

3.0.0(7y ago)08MITPHPPHP &gt;=7.1

Since Dec 18Pushed 7y agoCompare

[ Source](https://github.com/zeglup/MediaBundle)[ Packagist](https://packagist.org/packages/zeglup/media-bundle)[ Docs](https://github.com/zeglup/MediaBundle)[ RSS](/packages/zeglup-media-bundle/feed)WikiDiscussions master Synced today

READMEChangelog (1)Dependencies (9)Versions (23)Used By (0)

[![SensioLabsInsight](https://camo.githubusercontent.com/1d862535bc19132943708b01e18f261d9e57c9ffb9f1e562df36503351cd37f7/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32643330666537322d633237322d343037322d613834332d3137643739386236353431362f6d696e692e706e67)](https://insight.sensiolabs.com/projects/2d30fe72-c272-4072-a843-17d798b65416)

Give credits to Sonata, they inspired this bundle.

Installation
============

[](#installation)

### Composer

[](#composer)

```
composer require donjohn/media-bundle
```

### Minimal configuration

[](#minimal-configuration)

Create a new class and extends it with Donjohn\\MediaBundle\\Media

```
namespace YourBundle\Entity;
use Donjohn\MediaBundle\Model\Media as BaseMedia;

/**
 * @ORM\Table()
 * @ORM\Entity()
 */
class YourMedia extends BaseMedia
{
    /**
     * @var integer
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="IDENTITY")
    */
    protected $id;
}
```

### LiipImagineBundle

[](#liipimaginebundle)

Add this to your config.yml

```
liip_imagine:
    filter_sets:
        full:
            quality: 100
        thumbnail:
            quality: 75
            filters:
                auto_rotate: ~
                thumbnail: { size: [120, 120], mode: outbound }
```

See [LiipImagineBundle Configuration](http://symfony.com/doc/current/bundles/LiipImagineBundle/configuration.html) for liip filters configuration

### Optional configuration

[](#optional-configuration)

Change folder for uploaded files

```
donjohn_media:
    upload_folder: /AnotherFolder

liip_imagine:
    resolvers:
        default:
            web_path:
                cache_prefix: AnotherFolder/cache
```

Restrict uploaded file size

```
donjohn_media:
    file_max_size: 500M
```

### Providers

[](#providers)

Available providers :

- image
- file

### Usage

[](#usage)

To insert a media in the twig, use the block with an optional filter name, defined in the liip\_imagine.filter\_sets section. If you don't provider a filter name, 'reference' filter is default. it will return the original media uploaded with any filter or post processing.

```
{% media mediaObject, '' %}
```

You can also pass class/width/height/alt options to the media rendering:

```
{% media mediaObject, '' with {class: 'classwanted class2wanted', alt: 'title', width: '200px', height: '50px'} %}
```

### FormType

[](#formtype)

An Donjohn\\MediaBundle\\Form\\Type\\MediaType is available

```
$builder->add(, MediaType::class, ['media_class'=> YourEntity::class] );
```

provider option default value is null. A guesser will try on the fly to detect the best provider fo each file unless you define the option. The default guess is 'file'.

Set 'allow\_delete' option to false if you don't want to allow removing media from an entity. It removes the unlink checkbox in the form.

Set 'create\_on\_update' option to true if you don't want to update the current media when uploading a file but rather create a new media instead. Old one is not removed.

If you want to upload a collection of Medias set multiple to true.

```
$builder->add(, MediaType::class, ['media_class' => YourEntity::class, 'multiple' => true ] );
```

### OneupUploader

[](#oneupuploader)

For very large files, the bundle includes the Fine Uploader feature thanks to OneUpUploaderBundle.

```
$builder->add(, MediaType::class, , ['media_class' => YourEntity::class, 'fine_uploader' => true, 'multiple' =>  ] );
```

Don't forget to install fineuploader (bower/npm/...) and include the css/js in your layout (fix path if needed).

Add the OneupUploaderBundle to your AppKernel.php

```
    new Oneup\UploaderBundle\OneupUploaderBundle(),
```

And to config.yml, add:

```
# Read the documentation: https://github.com/1up-lab/OneupUploaderBundle/blob/master/Resources/doc/index.md
oneup_uploader:
    chunks:
        storage:
            directory: "%kernel.cache_dir%/uploader/chunks"
    mappings:
        donjohn_media:
            namer: Donjohn\MediaBundle\Uploader\Naming\OriginalNamer
            use_orphanage: true
            frontend: fineuploader
```

You can change the uploaded chunk size or the template used to render the fineuploader frame

```
donjohn_media:
    chunk_size: 50M #default
    fine_uploader_template: YourFineUploaderTempalte.twig.html
```

### Custom MediaProvider

[](#custom-mediaprovider)

To implement your own provider, extends the BaseProvider and redefine abstract function.
Autowiring should do the job...

### Api platform

[](#api-platform)

The bundle is compatible with [APIPlatform](https://api-platform.com/).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity68

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

Recently: every ~193 days

Total

20

Last Release

2625d ago

Major Versions

1.5.3 → 2.02017-03-06

2.0.2 → 3.0.02019-03-04

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

3.0.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e8a48114cb5301ca49a105286ed7997e8ff3589456b388dfc45d2f8cff755c0?d=identicon)[zeglup](/maintainers/zeglup)

---

Top Contributors

[![Donjohn](https://avatars.githubusercontent.com/u/1415326?v=4)](https://github.com/Donjohn "Donjohn (157 commits)")

---

Tags

symfonymedia

### Embed Badge

![Health badge](/badges/zeglup-media-bundle/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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