PHP code example of triawarman / yii2-richfilemanager

1. Go to this page and download the library: Download triawarman/yii2-richfilemanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

triawarman / yii2-richfilemanager example snippets


use yii\web\Controller;
use triawarman\richFilemanager\FileManagerAction;

class MediaManagerController extends Controller
{    

    public function beforeAction($action) {
        $this->enableCsrfValidation = false;
        return parent::beforeAction($action);
    }
    
    public function actions() {
        return[
            'file-manager'=>[
                'class' => FileManagerAction::className(),
                'auth' => true, //INFO: Default true, you could pass this option
                'serverConfig' => [
                    'options' =>[
                        "serverRoot" => true,
                        "fileRoot" => "/user_folder/"
                    ]
                ],
            ]
        ];
    }
}

<?= triawarman\richFilemanager\RichFilemanagerView::widget(); 

<?= triawarman\richFilemanager\RichFilemanagerView::widget({"apiConnectorUrl": "your_absolute_url"}); 

<?= triawarman\richFilemanager\RichFilemanagerView::widget({
"config":{
    "viewer":{
        "absolutePath":true,
        "previewUrl":"yourdomain.com/path/to/public_folder/",
        "pathToFileOnly": true
    },
}
}); 

php composer.phar