PHPackages                             blackbes/yii2-ckeditor-kcfinder-widget - 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. blackbes/yii2-ckeditor-kcfinder-widget

ActiveYii2-extension

blackbes/yii2-ckeditor-kcfinder-widget
======================================

CKEditor widget for Yii2 with support of KCfinder. Fork 2amigos

1.9.1(6y ago)2178↓100%BSD-3-ClausePHPCI failing

Since Nov 19Pushed 6y ago1 watchersCompare

[ Source](https://github.com/BlackBes/yii2-ckeditor-kcfinder-widget)[ Packagist](https://packagist.org/packages/blackbes/yii2-ckeditor-kcfinder-widget)[ Docs](http://yiiwheels.com/extension/ckeditor-widget)[ RSS](/packages/blackbes-yii2-ckeditor-kcfinder-widget/feed)WikiDiscussions master Synced today

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

CKEditor Widget for Yii2
========================

[](#ckeditor-widget-for-yii2)

[![Latest Version](https://camo.githubusercontent.com/c3508cb9ea68ec62007dd688785379e6bd74c5cf642fce6f1bc569cefbdc7f91/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f32616d69676f732f796969322d636b656469746f722d7769646765742e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/2amigos/yii2-ckeditor-widget/tags)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/dfcb928f64391f5890f0e259c13685d76999db4aa734051519b7172351f1b8d5/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f32616d69676f732f796969322d636b656469746f722d7769646765742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/2amigos/yii2-ckeditor-widget)[![Coverage Status](https://camo.githubusercontent.com/5e70dcb9f504535d0122fe18c7996b49930144d2127cf888135edc9b6173f2eb/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f32616d69676f732f796969322d636b656469746f722d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-ckeditor-widget/code-structure)[![Quality Score](https://camo.githubusercontent.com/8472ab70aa51bfad2730d957237fdf711a2b9c87e7c2affd7f723ebdbc71ff95/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f32616d69676f732f796969322d636b656469746f722d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/2amigos/yii2-ckeditor-widget)[![Total Downloads](https://camo.githubusercontent.com/bd7b8fbd1d373936d44cdc25d3c3e311f38391838d839dc9045df9251bdcb171/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f32616d69676f732f796969322d636b656469746f722d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/2amigos/yii2-ckeditor-widget)

Renders a [CKEditor WYSIWYG text editor plugin](http://www.ckeditor.com) widget.

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

[](#installation)

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

Either run

```
composer require blackbes/yii2-ckeditor-kcfinder-widget

```

or add

```
"blackbes/yii2-ckeditor-kcfinder-widget" : "~1.9"
```

also you need to make minimum stability to 'dev':

```
"minimum-stability": "dev"
```

and add KCFinder to dependency

```
"sunhater/kcfinder": "*"
```

to the require section of your application's `composer.json` file.

Skins &amp; Plugins
-------------------

[](#skins--plugins)

This widget works with default's `dev-full/stable` branch of CKEditor, with a set of plugins and skins. If you wish to configure a different skins or plugins that the one proposed, you will have to download them separately and configure the widget's `clientOptions` attribute accordingly.

Usage
-----

[](#usage)

The library comes with two widgets: `CKEditor` and `CKEditorInline`. One is for classic edition and the other for inline editing respectively.

Using a model with a basic preset:

```

use dosamigos\ckeditor\CKEditor;

```

Using inline edition with basic preset:

```

use dosamigos\ckeditor\CKEditorInline;

    This text can be edited now :)

```

How to add custom plugins
-------------------------

[](#how-to-add-custom-plugins)

This is the way to add custom plugins to the editor. Since version 2.0 we are working with the packagist version of the CKEditor library, therefore we are required to use its configuration API in order to add external plugins.

Lets add the popular [Code Editor Plugin](http://ckeditor.com/addon/pbckcode) for example. This plugin would allow us to add a button to our editor's toolbar so we can add code to the content we are editing.

Assuming you have downloaded the plugin and added to the root directory of your Yii2 site. I have it this way:

```
+ frontend
+ -- web
    + -- pbckcode
```

We can now add it to our CKEditor widget. For this example I am using `CKEditorInline` widget. One thing you notice on this example is that we do not use the preset attribute; this is highly important as we want to add a customized toolbar to our widget. No more talking, here is the code:

```
