承接 tecsin/yii2-elfinder 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tecsin/yii2-elfinder

最新稳定版本:1.0.2

Composer 安装命令:

composer require tecsin/yii2-elfinder

包简介

Elfinder file manager for yii2

README 文档

README

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

Installation

The preferred way to install this extension is through composer.

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

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 :

file-manager action view file

    
    /**
     * @var array clientOptions the options for configuration.
     * @see https://github.com/elfinder/wiki For full list of configurable options.
     */
<?= \tecsin\elfinder\ElFinderWidget::widget([
    'id' => 'working',
    'clientOptions' => [
        'url' => '/admin/upload'
    ]
]); ?>

elFinder File Browser(Picker) for TinyMCE :

file-browser action view file

<?= \tecsin\elfinder\ElFinderWidget::widget([
    'id' => 'working',
    'useWithTinyMCE' => true,//REQUIRED
    'clientOptions' => [
        'url' => '/admin/upload'
    ]
]); ?>

Contributions are welcome either by bug reporting or in coding more features.

统计信息

  • 总下载量: 803
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: CSS

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-04-23