https://github.com/simialbi/yii2-elfinder
This extension integrates the jQuery elFinder into yii2 framework
https://github.com/simialbi/yii2-elfinder
bootstrap3 component elfinder widget yii2
Last synced: 7 months ago
JSON representation
This extension integrates the jQuery elFinder into yii2 framework
- Host: GitHub
- URL: https://github.com/simialbi/yii2-elfinder
- Owner: simialbi
- License: mit
- Created: 2017-08-30T08:29:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-07-22T13:50:07.000Z (almost 2 years ago)
- Last Synced: 2025-08-01T19:36:42.902Z (10 months ago)
- Topics: bootstrap3, component, elfinder, widget, yii2
- Language: SCSS
- Homepage:
- Size: 423 KB
- Stars: 7
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# yii2-elfinder
This extension integrates the jQuery elFinder into yii2 framework (the yii way: with elFinder component, behaviors,
configurable objects, events etc.). Additionally it prevents jui/elfinder css from loading and provides it's own styles
for elfinder (bootstrap3 / fontawesome scss based style).
[](https://packagist.org/packages/simialbi/yii2-elfinder)
[](https://packagist.org/packages/simialbi/yii2-elfinder)
[](https://packagist.org/packages/simialbi/yii2-elfinder)
[](https://github.com/simialbi/yii2-elfinder/actions/workflows/build.yml)
## Resources
* [elFinder](https://github.com/Studio-42/elFinder)
* [yii2](https://github.com/yiisoft/yii2) framework
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```
$ php composer.phar require --prefer-dist simialbi/yii2-elfinder
```
or add
```
"simialbi/yii2-elfinder": "*"
```
to the ```require``` section of your `composer.json`
## Usage
### Setup Module
Add the module `elfinder` to the modules section of your configuration file:
```php
'modules' => [
'elfinder' => [
'class' => 'simialbi\yii2\elfinder\Module',
'options' => [
'default' => [
'class' => 'simialbi\yii2\elfinder\ElFinderOptions',
'locale' => 'de_DE.UTF-8',
'maxTargets' => 0
]
],
'connectionSets' => [
'default' => [ // like elfinder roots
[
'class' => 'simialbi\yii2\elfinder\ElFinderConfigurationLocalFileSystem',
'path' => '@webroot/files',
'URL' => '@web/files'
]
]
],
'volumeBehaviors' => [
'default' => [ // like elfinder plugins, add behaviors
'as resizer' => [
'class' => 'simialbi\yii2\elfinder\behaviors\ImageResizeBehavior',
'maxWidth' => 1920,
'maxHeight' => 1080,
'quality' => 70
],
'as optimizer' => [
'class' => 'simialbi\yii2\elfinder\behaviors\ImageOptimizeBehavior'
]
]
]
]
]
```
## Example Usage
### Elfinder widget
To include an elfinder instance in one of your pages, call the elfinder widget like this:
```php
title = 'elFinder';
$this->params['breadcrumbs'][] = $this->title;
?>
'default' // from module connectionSets/volumeBehaviors configuration (array key)
]);
?>
```
All options from [elfinder client configuration options](https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1)
and `instanceName` can be used to configure the widget.
### ElFinderInput widget
To include an elfinder input field widget, call the input widget like this:
```php
title = 'elFinder';
$this->params['breadcrumbs'][] = $this->title;
?>
'my-file',
'value' => '/path/to/my/file.ext',
'instanceName' => 'default'
]);
// or model like usage
/* @var $form \yii\widgets\ActiveForm */
/* @var $model \yii\base\Model */
echo $form->field($model, 'my-file')->widget(
ElFinderInput::className(),
[
'instanceName' => 'default'
]
);
?>
```
## License
**yii2-elfinder** is released under MIT license. See bundled [LICENSE](LICENSE) for details.