maddoger / yii2-filebehavior
File behavior for Yii2.
Installs: 1 385
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 0
Type:yii2-extension
pkg:composer/maddoger/yii2-filebehavior
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2025-10-25 23:32:08 UTC
README
File field behavior for Yii 2
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist maddoger/yii2-filebehavior "*"
or add
"maddoger/yii2-filebehavior": "*"
to the require section of your composer.json file.
In model behaviors:
[
'class' => 'maddoger\filebehavior\FileBehavior',
'attribute' => 'file_attribute',
'deleteAttribute' => 'deleteFile',
'fileName' => function ($model, $file, $index) {
return md5($file->name).'.'.$file->extension;
},
'basePath' => '@webapp/uploads/files',
'baseUrl' => '@web/uploads/files',
'overwriteFile' => false,
],