An open API service indexing awesome lists of open source software.

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

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).

[![Latest Stable Version](https://poser.pugx.org/simialbi/yii2-elfinder/v/stable?format=flat-square)](https://packagist.org/packages/simialbi/yii2-elfinder)
[![Total Downloads](https://poser.pugx.org/simialbi/yii2-elfinder/downloads?format=flat-square)](https://packagist.org/packages/simialbi/yii2-elfinder)
[![License](https://poser.pugx.org/simialbi/yii2-elfinder/license?format=flat-square)](https://packagist.org/packages/simialbi/yii2-elfinder)
[![Build Status](https://github.com/simialbi/yii2-elfinder/actions/workflows/build.yml/badge.svg)](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.