PHPackages                             artgris/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. [Database &amp; ORM](/categories/database)
4. /
5. artgris/media-bundle

AbandonedArchivedSymfony-bundle[Database &amp; ORM](/categories/database)

artgris/media-bundle
====================

Easier Symfony Form Media Management

6.3.1(3y ago)4877.4k↓20%20[1 PRs](https://github.com/artgris/MediaBundle/pulls)2PHPPHP &gt;=7.1.3

Since May 12Pushed 3y ago4 watchersCompare

[ Source](https://github.com/artgris/MediaBundle)[ Packagist](https://packagist.org/packages/artgris/media-bundle)[ Docs](https://github.com/Artgris/MediaBundle)[ RSS](/packages/artgris-media-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (68)Used By (2)

artgris/MediaBundle - Easier Symfony Media Management
-----------------------------------------------------

[](#artgrismediabundle---easier-symfony-media-management)

> Repository is no longer maintained. A more modern alternative of this bundle exists: Arkounay ux-media bundle - Symfony UX async document upload type using ArtgrisFileManager :

### Prerequisites

[](#prerequisites)

- symfony &gt;= 4.1
- [artgris/FileManagerBundle](https://github.com/artgris/FileManagerBundle#add-following-configuration-)
- Assets:
    - CSS: [bootstrap 4 or 5](http://getbootstrap.com/) and [Font Awesome](http://fontawesome.io/)
    - JS: [jQuery](https://jquery.com/), [ninsuo/symfony-collection](https://github.com/ninsuo/symfony-collection) and [jQuery UI](https://jqueryui.com/)

[![demo-gif](https://github.com/artgris/MediaBundle/raw/master/demo.gif)](https://github.com/artgris/MediaBundle/raw/master/demo.gif)

### Getting Started

[](#getting-started)

- Download the files:

    ```
      composer require artgris/media-bundle

    ```
- In `AppKernel.php` add the bundle:

    ```
      new Artgris\Bundle\MediaBundle\ArtgrisMediaBundle()

    ```
- Then, run the following command:

    ```
      php bin/console assets:install

    ```
- In your twig template, you will then need to import the required assets:

    - CSS (**requires [bootstrap](http://getbootstrap.com/) and [Font Awesome](http://fontawesome.io/)**):

```
        {# Bootstrap 4 #}

        {# or Bootstrap 5 #}

        {# Font Awesome #}

        {# Artgris FileManager #}

        {# Import fengyuanchen/cropper #}

        {# Then the default bundle's CSS #}

```

- JS (**requires [jQuery](https://jquery.com/), [ninsuo/symfony-collection](https://github.com/ninsuo/symfony-collection) and [jQuery UI](https://jqueryui.com/)**):

```
    {# jQuery #}

    {# Bootstrap 4 #}

    {# or Bootstrap 5 #}

    {# Jqueri UI #}

    {# jquery.collection.js #}

    {# Import fengyuanchen/cropper #}

    {# Then the default bundle's JavaScript: #}
    {% include '@ArtgrisMedia/assets/include_js.html.twig' %}
```

- In `routing.yml`, you will need to import the Ajax route:

```
 artgris_media:
     resource: "@ArtgrisMediaBundle/Resources/config/routing.yml"
     prefix: /admin
```

### Usage

[](#usage)

In an entity, add the path attributes as string. You can also use doctrine's types such as `simple_array`, `array`, `json` for collections.

```
use Artgris\Bundle\MediaBundle\Form\Validator\Constraint as MediaAssert; // optionnal, to force image files

// ...

/**
 * @var string
 * @ORM\Column(type="string")
 * @Assert\NotNull()
 */
private $image;

/**
 * @var Collection|string[]
 * @ORM\Column(type="simple_array", nullable=true)
 * @MediaAssert\Image()
 */
private $gallery;
```

Then, use a form builder and assigne the `MediaType` class for a single file, or the `MediaCollectionType` for multiple files.

```
use Artgris\Bundle\MediaBundle\Form\Type\MediaType;
use Artgris\Bundle\MediaBundle\Form\Type\MediaCollectionType;

// ...

$builder
    ->add('image', MediaType::class, [
        'conf' => 'default'
    ])
    ->add('gallery', MediaCollectionType::class, [
        'conf' => 'default'
    ]);
```

### Options:

[](#options)

**MediaType:**

- `'conf' => 'yourconf'` (**required**) specifies a configuration defined in the FileManager. For more informations about media configurations, [refer to FileManagerBundle's documentation](https://github.com/artgris/FileManagerBundle#add-following-configuration-)
- `'extra' => []` (only with FileManagerBundle Service Configuration) [Extra Url parameters injections](https://github.com/artgris/FileManagerBundle/blob/master/Resources/doc/book/2-service-configuration.md#extra-url-parameters-injections)
- `'readonly' => false` prevents the user from manually changing the path (it only adds a "readonly" attribute to the corresponding HTML input)
- `'allow_crop' => true` allows the user to edit the image using [fengyuanchen/cropper](https://github.com/fengyuanchen/cropper)
- `'crop_options' => array` if `allow_crop` is set to `true`, allows to specify extra crop options. The default options:

```
'crop_options' => [
    'display_crop_data' => true,    // will display crop box informations (x, y, width, height, and ratio if there is one)
    'allow_flip' => true,           // allows to flip the image vertically and horizontally
    'allow_rotation' => true,       // allows to rotate the image (90 degrees)
    'ratio' => false                // force a crop ratio. E.g 16/9
],
```

**MediaCollectionType:**

- `'conf' => 'yourconf'` (**required**) specifies a configuration defined in the FileManager. For more informations about media configurations, [refer to FileManagerBundle's documentation](https://github.com/artgris/FileManagerBundle#add-following-configuration-)

Some [ninsuo/symfony-collection](https://github.com/ninsuo/symfony-collection)'s options are available directly:

- `'min' => 0`
- `'max' => 100`
- `'init_with_n_elements' => 1`
- `'add_at_the_end' => true`

Like regular collections, you can edit entries options, i.e to enable alts:

```
'entry_options' => [
    'display_file_manager' => false
]
```

### Changing cropping path

[](#changing-cropping-path)

add config/packages/artgris\_media.yaml

```
artgris_media:
    cropped_path: "cropped/" #default value

```

### Demo Application

[](#demo-application)

[MediaBundleDemo](https://github.com/artgris/MediaBundleDemo) is a complete Symfony application created to showcase MediaBundle features.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity43

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity73

Established project with proven stability

 Bus Factor1

Top contributor holds 70.9% 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 ~28 days

Recently: every ~78 days

Total

66

Last Release

1450d ago

Major Versions

1.1.2 → 2.0.02018-07-06

2.2 → 3.02018-09-30

3.0.1 → 4.0.02018-10-29

4.0.3 → 5.0.02019-01-28

5.x-dev → 6.0.02020-06-29

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

2.0.0PHP &gt;=7.0.0

6.0.0PHP ^7.1.3

6.1.1PHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/c20e3e35bd4120b6563ce69bb5a801c00ee7d83c188e7cd7b1b6060d0d9daa64?d=identicon)[artgris](/maintainers/artgris)

---

Top Contributors

[![artgris](https://avatars.githubusercontent.com/u/22889596?v=4)](https://github.com/artgris "artgris (73 commits)")[![Arkounay](https://avatars.githubusercontent.com/u/9340719?v=4)](https://github.com/Arkounay "Arkounay (27 commits)")[![linkrb](https://avatars.githubusercontent.com/u/900590?v=4)](https://github.com/linkrb "linkrb (1 commits)")[![nedvajz](https://avatars.githubusercontent.com/u/1135477?v=4)](https://github.com/nedvajz "nedvajz (1 commits)")[![viniciusgpoliveira](https://avatars.githubusercontent.com/u/13926090?v=4)](https://github.com/viniciusgpoliveira "viniciusgpoliveira (1 commits)")

---

Tags

bundlemanagementmediasymfonysymfony-bundlesymfonybundledoctrinemediaform

### Embed Badge

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

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

###  Alternatives

[sonata-project/doctrine-orm-admin-bundle

Integrate Doctrine ORM into the SonataAdminBundle

46117.7M155](/packages/sonata-project-doctrine-orm-admin-bundle)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[spiriitlabs/form-filter-bundle

This bundle aim to provide classes to build some form filters and then build a doctrine query from this form filter.

36465.8k8](/packages/spiriitlabs-form-filter-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.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

813.1k](/packages/ahmed-bhs-doctrine-doctor)[huluti/doctrine-relations-analyser

A Symfony bundle that provides tools for analyzing Doctrine relationships

145.3k](/packages/huluti-doctrine-relations-analyser)

PHPackages © 2026

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