PHPackages                             oleg-chulakov-studio/yii2-filesaver - 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. oleg-chulakov-studio/yii2-filesaver

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

oleg-chulakov-studio/yii2-filesaver
===================================

Yii2 behavior for saving file in model

1.0.0(8y ago)120BSD 3-ClausePHPPHP &gt;=5.4.0

Since Jul 12Pushed 8y ago5 watchersCompare

[ Source](https://github.com/OlegChulakovStudio/yii2-filesaver)[ Packagist](https://packagist.org/packages/oleg-chulakov-studio/yii2-filesaver)[ RSS](/packages/oleg-chulakov-studio-yii2-filesaver/feed)WikiDiscussions master Synced 4w ago

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

Yii2 behavior for file saving in model
======================================

[](#yii2-behavior-for-file-saving-in-model)

[Russian](README.ru.md)

Install by composer
-------------------

[](#install-by-composer)

composer require oleg-chulakov-studio/yii2-filesaver

Or add this code into require section of your composer.json and then call composer update in console
----------------------------------------------------------------------------------------------------

[](#or-add-this-code-into-require-section-of-your-composerjson-and-then-call-composer-update-in-console)

"oleg-chulakov-studio/yii2-filesaver": "\*"

Usage
-----

[](#usage)

- In model add behavior

```
    public function behaviors()
    {
        return [
            ....
            [
                'class' => FileSaverBehavior::className(),
                'group_type' => 'photo',
                'in_attribute' => 'photoFile',
                'out_attribute' => 'photo_id',
                'del_attribute' => 'photoDel',
                'allowedExtensions' => [
                    'png',
                    'jpeg',
                    'jpg'
                ]
            ],
            ...
        ];
    }
```

- In model add fields

```
/**
 * @var UploadedFile
/**
$photoFile;

 /**
  * @var boolean
 /**
$photoDel;
```

### Example usage

[](#example-usage)

- saving by url

```
$model = new TestModel();
$model->photoFile = new \sem\filestorage\adapters\RemoteFile($url);
$model->save();
```

- saving by upload in form

```
$model = new TestModel();
$model->photoFile = UploadedFile::getInstance($model, 'photoFile');
$model->save();
```

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3275d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7cb11be37853072fe7ab807b40211e2c135bc04bf5c7c79d9c523dc4022ed2d?d=identicon)[Oleg Chulakov Studio](/maintainers/Oleg%20Chulakov%20Studio)

### Embed Badge

![Health badge](/badges/oleg-chulakov-studio-yii2-filesaver/health.svg)

```
[![Health](https://phpackages.com/badges/oleg-chulakov-studio-yii2-filesaver/health.svg)](https://phpackages.com/packages/oleg-chulakov-studio-yii2-filesaver)
```

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

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