PHP code example of myzero1 / yii2-ckeditor

1. Go to this page and download the library: Download myzero1/yii2-ckeditor 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/ */

    

myzero1 / yii2-ckeditor example snippets


<?= myzero1\ckeditor\CKEditor::widget(['name' => 'attributeName']) 

<?= myzero1\ckeditor\CKEditor::widget([
    'name' => 'attributeName',
    'clientOptions' => [
        'extraPlugins' => 'autogrow,colorbutton,colordialog,iframe,justify,showblocks,preview,image2',
        // 'extraPlugins' => 'autogrow,colorbutton,colordialog,iframe,justify,showblocks,preview,easyimage',
        'removePlugins' => 'resize,image',
        'autoGrow_maxHeight' => 900,
        'stylesSet' => [
            ['name' => 'Subscript', 'element' => 'sub'],
            ['name' => 'Superscript', 'element' => 'sup'],
        ],
    ],
]) 

<?= $form->field($model, 'attributeName')->widget(myzero1\ckeditor\CKEditor::className()) 

<?= $form->field($model, 'attributeName')->widget(myzero1\ckeditor\CKEditor::className(), [
        'clientOptions' => [
            'selectMultiple' => true,
            'filebrowserImageUploadUrl' => '/ckeditor/upload-image',
            'imageUploadUrl' => '/ckeditor/upload-image',
            'extraPlugins' => 'autogrow,colorbutton,colordialog,iframe,justify,showblocks,preview,image2',
            // 'extraPlugins' => 'autogrow,colorbutton,colordialog,iframe,justify,showblocks,image2,preview,easyimage',
            'removePlugins' => 'resize,image',
            'autoGrow_maxHeight' => 900,
            'stylesSet' => [
                ['name' => 'Subscript', 'element' => 'sub'],
                ['name' => 'Superscript', 'element' => 'sup'],
            ],
        ],
    ]) 

php composer.phar 


return [
    ......
    'controllerNamespace' => 'backend\controllers',
    'controllerMap' => [
        'ckeditor' => [
            'class' => 'myzero1\ckeditor\CKditorController',
            'config' => [
                'imageFieldName' => 'upload',
                'imageMaxSize' => 1024*1024*2, // 2M = 1024*1024*2
                'imageAllowFiles' => ['.jpg', '.jpeg', '.png', '.gif'],
                'imagePathFormat' => '/upload/image/{yyyy}{mm}{dd}/{time}{rand:8}',
            ],
        ]
    ],
    'bootstrap' => ['log'],
    ......