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

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

mhndev/yii2-media
=================

Media Manipulation and storage control (limitation) in Yii2

0.0.5(9y ago)449MITPHP

Since Sep 20Pushed 9y ago3 watchersCompare

[ Source](https://github.com/mhndev/yii2-media)[ Packagist](https://packagist.org/packages/mhndev/yii2-media)[ RSS](/packages/mhndev-yii2-media/feed)WikiDiscussions develop Synced today

READMEChangelog (1)Dependencies (2)Versions (8)Used By (0)

Yii2 Media Manipulation Module
==============================

[](#yii2-media-manipulation-module)

media manipulation implementation in Yii2

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require --prefer-dist mhndev/yii2-media "0.*"

```

or add

```
"mhndev/yii2-media": "0.*"

```

to the require section of your `composer.json` file.

Introduction
------------

[](#introduction)

This package helps you manipulate any kind of media (image , video, text, pdf, ...) for any kind of entity you like. for example consider you have a Post Entity , first of all you should use EntityTrait in your model just like following :

```
namespace app\models;

use mhndev\yii2Media\Interfaces\iEntity;
use mhndev\yii2Media\Traits\EntityTrait;
use yii\db\ActiveRecord;

/**
 * Class Post
 * @package app\models
 */
class Post extends ActiveRecord implements iEntity
{

    use EntityTrait;

    /**
     * @return string
     */
    public static function tableName()
    {
        return 'posts';
    }

}
```

this package also helps you upload media and specify max upload size for any kind of media and mime types and also you can specify this package log if memory directory size which you upload file is less than x MB.

create a config file called media like follow :

```
