{"id":14966786,"url":"https://github.com/alexantr/yii2-elfinder","last_synced_at":"2025-10-25T17:30:37.925Z","repository":{"id":56944394,"uuid":"72883377","full_name":"alexantr/yii2-elfinder","owner":"alexantr","description":"elFinder file manager for Yii 2","archived":false,"fork":false,"pushed_at":"2021-08-20T14:18:26.000Z","size":76,"stargazers_count":26,"open_issues_count":1,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-31T09:34:05.911Z","etag":null,"topics":["elfinder","filemanager","yii2","yii2-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexantr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-04T20:34:46.000Z","updated_at":"2024-05-01T11:50:49.000Z","dependencies_parsed_at":"2022-08-21T07:20:13.885Z","dependency_job_id":null,"html_url":"https://github.com/alexantr/yii2-elfinder","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexantr%2Fyii2-elfinder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexantr%2Fyii2-elfinder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexantr%2Fyii2-elfinder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexantr%2Fyii2-elfinder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexantr","download_url":"https://codeload.github.com/alexantr/yii2-elfinder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238183707,"owners_count":19430173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elfinder","filemanager","yii2","yii2-extension"],"created_at":"2024-09-24T13:36:56.683Z","updated_at":"2025-10-25T17:30:37.641Z","avatar_url":"https://github.com/alexantr.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# elFinder file manager for Yii 2\n\nThis extension integrates an [elFinder 2.1](http://studio-42.github.io/elFinder/) file manager into\n[Yii framework 2.0](http://www.yiiframework.com).\n\n[![Latest Stable Version](https://img.shields.io/packagist/v/alexantr/yii2-elfinder.svg)](https://packagist.org/packages/alexantr/yii2-elfinder)\n[![Total Downloads](https://img.shields.io/packagist/dt/alexantr/yii2-elfinder.svg)](https://packagist.org/packages/alexantr/yii2-elfinder)\n[![License](https://img.shields.io/github/license/alexantr/yii2-elfinder.svg)](https://raw.githubusercontent.com/alexantr/yii2-elfinder/master/LICENSE)\n[![Build Status](https://travis-ci.org/alexantr/yii2-elfinder.svg?branch=master)](https://travis-ci.org/alexantr/yii2-elfinder)\n\n## Installation\n\nInstall extension through [composer](http://getcomposer.org/):\n\n```\ncomposer require alexantr/yii2-elfinder\n```\n\n## Usage\n\n### Configure actions\n\nFor using elFinder you must create and configure controller. See complete example with actions for elFinder's connector,\n`InputFile` widget, CKEditor `filebrowser*` options and TinyMCE `file_picker_callback` option:\n\n```php\n\u003c?php\n\nnamespace app\\controllers;\n\nuse alexantr\\elfinder\\CKEditorAction;\nuse alexantr\\elfinder\\ConnectorAction;\nuse alexantr\\elfinder\\InputFileAction;\nuse alexantr\\elfinder\\TinyMCEAction;\nuse Yii;\nuse yii\\web\\Controller;\n\nclass ElfinderController extends Controller\n{\n    public function actions()\n    {\n        return [\n            'connector' =\u003e [\n                'class' =\u003e ConnectorAction::className(),\n                'options' =\u003e [\n                    'roots' =\u003e [\n                        [\n                            'driver' =\u003e 'LocalFileSystem',\n                            'path' =\u003e Yii::getAlias('@webroot') . DIRECTORY_SEPARATOR . 'uploads',\n                            'URL' =\u003e Yii::getAlias('@web') . '/uploads/',\n                            'mimeDetect' =\u003e 'internal',\n                            'imgLib' =\u003e 'gd',\n                            'accessControl' =\u003e function ($attr, $path) {\n                                // hide files/folders which begins with dot\n                                return (strpos(basename($path), '.') === 0) ?\n                                    !($attr == 'read' || $attr == 'write') :\n                                    null;\n                            },\n                        ],\n                    ],\n                ],\n            ],\n            'input' =\u003e [\n                'class' =\u003e InputFileAction::className(),\n                'connectorRoute' =\u003e 'connector',\n            ],\n            'ckeditor' =\u003e [\n                'class' =\u003e CKEditorAction::className(),\n                'connectorRoute' =\u003e 'connector',\n            ],\n            'tinymce' =\u003e [\n                'class' =\u003e TinyMCEAction::className(),\n                'connectorRoute' =\u003e 'connector',\n            ],\n        ];\n    }\n}\n```\n\nReed [elFinder docs](https://github.com/Studio-42/elFinder/wiki/Connector-configuration-options-2.1) to configure\nconnector options.\n\n### InputFile widget\n\nExample of `InputFile` widget with enabled mime filter and preview:\n\n```php\n\u003c?= alexantr\\elfinder\\InputFile::widget([\n    'name' =\u003e 'attributeName',\n    'clientRoute' =\u003e 'elfinder/input',\n    'filter' =\u003e ['image'],\n    'preview' =\u003e function ($value) {\n        return yii\\helpers\\Html::img($value, ['width' =\u003e 200]);\n    },\n]) ?\u003e\n```\n\n*Note 1:* Filter option is using to display only certain files based on their mime type. Check `onlyMimes` option\nin [elFinder docs](https://github.com/Studio-42/elFinder/wiki/Client-configuration-options-2.1#onlyMimes).\n\n*Note 2:* Preview displays only predefined (saved earlier) input value and not updating on the fly after new selection.\n\nIf you want to use the `InputFile` widget in `ActiveForm`, it can be done like this:\n\n```php\n\u003c?= $form-\u003efield($model, 'attributeName')\n    -\u003ewidget(alexantr\\elfinder\\InputFile::className(), [\n        'clientRoute' =\u003e 'elfinder/input',\n    ]) ?\u003e\n```\n\nUsing textarea instead text input (can be useful with enabled multiple selection):\n\n```php\n\u003c?= alexantr\\elfinder\\InputFile::widget([\n    'name' =\u003e 'attributeName',\n    'clientRoute' =\u003e 'elfinder/input',\n    'textarea' =\u003e true,\n    'textareaRows' =\u003e 3, // default is 5\n]) ?\u003e\n```\n\nEnable multiple selection to select more than one file in one input:\n\n```php\n\u003c?= alexantr\\elfinder\\InputFile::widget([\n    'name' =\u003e 'attributeName',\n    'clientRoute' =\u003e 'elfinder/input',\n    'multiple' =\u003e true,\n]) ?\u003e\n```\n\nDefault paths separator for text input is comma and newline character for textarea.\nYou can change them in `InputFileAction` configuration:\n\n```php\nclass ElfinderController extends Controller\n{\n    public function actions()\n    {\n        return [\n            // ...\n            'input' =\u003e [\n                'class' =\u003e InputFileAction::className(),\n                'connectorRoute' =\u003e 'connector',\n                'separator' =\u003e ',',\n                'textareaSeparator' =\u003e '\\n', // newline character in javascript\n            ],\n            // ...\n        ];\n    }\n}\n```\n\n### Integration with CKEditor\n\nFor using elFinder with CKEditor widget (like [this one](https://github.com/alexantr/yii2-ckeditor)) you need to\nspecify options `filebrowserBrowseUrl` and (or) `filebrowserImageBrowseUrl`:\n\n```php\n\u003c?= alexantr\\ckeditor\\CKEditor::widget([\n    'name' =\u003e 'attributeName',\n    'clientOptions' =\u003e [\n        // ...\n        'filebrowserBrowseUrl' =\u003e yii\\helpers\\Url::to(['elfinder/ckeditor']),\n        'filebrowserImageBrowseUrl' =\u003e yii\\helpers\\Url::to(['elfinder/ckeditor', 'filter' =\u003e 'image']),\n    ],\n]) ?\u003e\n```\n\n*Note:* For `filebrowserImageBrowseUrl` we use filter query param to display only images.\n\n### Integration with TinyMCE 4 \u0026 5\n\nFor using elFinder with TinyMCE widget (like [this one](https://github.com/alexantr/yii2-tinymce)) you need to\nspecify option `file_picker_callback`:\n\n```php\n\u003c?= alexantr\\tinymce\\TinyMce::widget([\n    'name' =\u003e 'attributeName',\n    'clientOptions' =\u003e [\n        // ...\n        'file_picker_callback' =\u003e alexantr\\elfinder\\TinyMCE::getFilePickerCallback(['elfinder/tinymce']),\n    ],\n]) ?\u003e\n```\n\n*Note:* option `file_picker_callback` available since 4.1.0 version of TinyMCE js plugin.\n\nWith second param in `getFilePickerCallback()` you can set additional settings for\n`tinymce.activeEditor.windowManager.open` (TinyMCE 4) or `tinymce.activeEditor.windowManager.openUrl` (TinyMCE 5):\n\n```php\nTinyMCE::getFilePickerCallback(['elfinder/tinymce'], ['width' =\u003e 1200, 'height' =\u003e 600])\n```\n\n### Standalone file manager\n\nAdd `ElFinder` widget to any view:\n\n```php\n\u003c?= alexantr\\elfinder\\ElFinder::widget([\n    'connectorRoute' =\u003e ['elfinder/connector'],\n    'settings' =\u003e [\n        'height' =\u003e 640,\n    ],\n    'buttonNoConflict' =\u003e true,\n]) ?\u003e\n```\n\n*Note:* If you are using Bootstrap 3 enable `buttonNoConflict` option to resolve conflict between\nBootstrap and jQuery UI buttons.\n\n## Links\n\n* [elFinder Wiki](https://github.com/Studio-42/elFinder/wiki)\n* [CKEditor widget](https://github.com/alexantr/yii2-ckeditor) by [alexantr](https://github.com/alexantr)\n* [TinyMCE widget](https://github.com/alexantr/yii2-tinymce) by [alexantr](https://github.com/alexantr)\n* [CKEditor widget](https://github.com/2amigos/yii2-ckeditor-widget) by [2amigos](https://github.com/2amigos)\n* [TinyMCE widget](https://github.com/2amigos/yii2-tinymce-widget) by [2amigos](https://github.com/2amigos)\n* [Yii framework site](http://www.yiiframework.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexantr%2Fyii2-elfinder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexantr%2Fyii2-elfinder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexantr%2Fyii2-elfinder/lists"}