PHPackages                             mecsu/yii2-media - 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. mecsu/yii2-media

ActiveYii2-extension[File &amp; Storage](/categories/file-storage)

mecsu/yii2-media
================

Media library

08PHP

Since Jan 10Pushed 3y agoCompare

[ Source](https://github.com/mecsu/yii2-media)[ Packagist](https://packagist.org/packages/mecsu/yii2-media)[ RSS](/packages/mecsu-yii2-media/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Yii2](https://camo.githubusercontent.com/3f29058a9886ae3e9efc09df82d551051f8ea6c8da1176d9e8ca8a64be6f9b40/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f72657175697265642d596969325f76322e302e34302d626c75652e737667)](https://packagist.org/packages/yiisoft/yii2)[![Downloads](https://camo.githubusercontent.com/aaf8c4970fbf274365e12d8a946e10d3094497b409ddb1825dbd1663da9166b8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d656373752f796969322d6d656469612e737667)](https://packagist.org/packages/mecsu/yii2-media)[![Packagist Version](https://camo.githubusercontent.com/3ed7340bf3bdae2e8d0d73dd53cdfedef37627e5a2c071d3e8bcccb93090c16b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d656373752f796969322d6d656469612e737667)](https://packagist.org/packages/mecsu/yii2-media)[![Progress](https://camo.githubusercontent.com/d2c102b075c16f8a841e697b04c43bc93c8d092c5795ad8b3090d7fa993c258a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f67726573732d72656164795f746f5f7573652d677265656e2e737667)](https://camo.githubusercontent.com/d2c102b075c16f8a841e697b04c43bc93c8d092c5795ad8b3090d7fa993c258a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70726f67726573732d72656164795f746f5f7573652d677265656e2e737667)[![GitHub license](https://camo.githubusercontent.com/08cadafb593228f9d05d4e4c8d8dc02b4848ec35604cfc18a91ef8b96462344f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d656373752f796969322d6d656469612e737667)](https://github.com/mecsu/yii2-media/blob/master/LICENSE)

[![Yii2 Media](./docs/images/yii2-media.png)](./docs/images/yii2-media.png)

Yii2 Media
==========

[](#yii2-media)

Media library for Yii2 with media categories and drag'n'drop uploader.

This module is an integral part of the [Butterfly.СMS](https://butterflycms.com/) content management system, but can also be used as an standalone extension.

Copyrights (c) 2019-2021 [W.D.M.Group, Ukraine](https://wdmg.com.ua/)

Requirements
============

[](#requirements)

- PHP 5.6 or higher
- Yii2 v.2.0.40 and newest
- [Yii2 Base](https://github.com/wdmg/yii2-base) module (required)
- [Yii2 Imagine](https://github.com/yiisoft/yii2-imagine) extension (required)
- [Yii2 SelectInput](https://github.com/wdmg/yii2-selectinput) widget

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

[](#installation)

To install the module, run the following command in the console:

`$ composer require "mecsu/yii2-media"`

After configure db connection, run the following command in the console:

`$ php yii media/init`

And select the operation you want to perform:

1. Apply all module migrations
2. Revert all module migrations

Migrations
==========

[](#migrations)

In any case, you can execute the migration and create the initial data, run the following command in the console:

`$ php yii migrate --migrationPath=@vendor/mecsu/yii2-media/migrations`

Configure
=========

[](#configure)

To add a module to the project, add the following data in your configuration file:

```
'modules' => [
    ...
    'media' => [
        'class' => 'mecsu\media\Module',
        'routePrefix' => 'admin',
        'mediaRoute' => '/media', // Routes to render media item (use "/" - for root)
        'mediaCategoriesRoute' => '/media/categories', // Routes to render media categories (use "/" - for root)
        'mediaPath' => '/uploads/media', // Path to save media files in @webroot
        'mediaThumbsPath' => '/uploads/media/_thumbs', // Path to save media thumbnails in @webroot
        'maxFilesToUpload' => 10, // maximum files to upload
        'maxUploadSize' => 5242880, // max file size in bytes to upload
        'allowedMime' => [ // allowed mime types
            'image/png' => true,
            'image/jpeg' => true,
            'image/gif' => true,
            'image/svg+xml' => true,
            'application/pdf' => true,
            'application/msword' => true,
            'application/vnd.ms-excel' => true,
            'application/rtf' => true,
            'text/csv' => true,
            'text/plain' => true,
            ...
        ]
    ],
    ...
],

```

Routing
=======

[](#routing)

Use the `Module::dashboardNavItems()` method of the module to generate a navigation items list for NavBar, like this:

```

```

Status and version \[ready to use\]
===================================

[](#status-and-version-ready-to-use)

- v.1.0.6 - RBAC implementation, read EXIF
- v.1.0.5 - Update README.md
- v.1.0.4 - Added drag-n-drop for upload
- v.1.0.3 - Log activity
- v.1.0.2 - Added pagination, up to date dependencies
- v.1.0.1 - Check file not exists or generate unique filename
- v.1.0.0 - CRUD for media items/categories, translations
- v.0.0.3 - Upload functionality, mime types validator and preview thumbnails

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 84.2% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/269eb90fdbaab7272bc201e905006d2b773d463ea5d38f6104ee4ef7e4676479?d=identicon)[mecsu](/maintainers/mecsu)

---

Top Contributors

[![alex-wdmg](https://avatars.githubusercontent.com/u/1635637?v=4)](https://github.com/alex-wdmg "alex-wdmg (32 commits)")[![xuanhnvt](https://avatars.githubusercontent.com/u/6037186?v=4)](https://github.com/xuanhnvt "xuanhnvt (6 commits)")

### Embed Badge

![Health badge](/badges/mecsu-yii2-media/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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