PHPackages                             tecsin/yii2-elfinder - 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. tecsin/yii2-elfinder

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

tecsin/yii2-elfinder
====================

Elfinder file manager for yii2

1.0.2(9y ago)18081BSD-3-ClauseCSS

Since Apr 23Pushed 9y ago1 watchersCompare

[ Source](https://github.com/onyijne/yii2-elfinder)[ Packagist](https://packagist.org/packages/tecsin/yii2-elfinder)[ RSS](/packages/tecsin-yii2-elfinder/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (3)Dependencies (4)Versions (4)Used By (1)

Yii2 Elfinder Extension
=======================

[](#yii2-elfinder-extension)

Elfinder file manager for yii2. Supports Local file system, FTP, and uses Flysystem to mount Google Drive when used.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist tecsin/yii2-elfinder "*"

```

or add

```
"tecsin/yii2-elfinder": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

Controller

```
class AdminController extends Controller
{

  public function actionUpload(){
     $fileManager = new \tecsin\elfinder\FileManager();
      $fileManager->_uploadPath = Yii::getAlias('@webroot').'/files/';
      $fileManager->_uploadUrl = Yii::getAlias('@web').'/files/';
      /*to mount Google Drive with flysystem starts. OPTIONAL*/
      $fileManager->googleDrive = [
                  'clientID' => 'xxxxxx',
                  'clientSecret' => 'xxxxxxx',
                  'refreshToken' => 'xxxxxx',
                  'useCache' => true //optional
                  ];
      /*to mount Google Drive ends*/
      $fileManager->connector();
  }

 /**to use only for file manager for web**/
    public function actionFileManager() {
        return $this->render('file-manager');
    }

/**to use only for file browser (picker) for tinymce**/
  public function actionFileBrowser(){
      return $this->renderAjax('file-browser');//use ajax not to have a new site load in the file browser window
  }

}
```

elFinder File Manager for Web :
-------------------------------

[](#elfinder-file-manager-for-web--)

file-manager action view file

```

    /**
     * @var array clientOptions the options for configuration.
     * @see https://github.com/elfinder/wiki For full list of configurable options.
     */
