PHPackages                             davidxu/yii2-imperavi-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. [Templating &amp; Views](/categories/templating)
4. /
5. davidxu/yii2-imperavi-widget

ActiveYii2-extension[Templating &amp; Views](/categories/templating)

davidxu/yii2-imperavi-widget
============================

The imperavi redactor widget for Yii 2 framework with qiniu upload function added.

2.1.3(5y ago)022BSD-3-ClauseJavaScript

Since Jul 5Pushed 5y agoCompare

[ Source](https://github.com/davidxuuts/yii2-imperavi-widget)[ Packagist](https://packagist.org/packages/davidxu/yii2-imperavi-widget)[ Docs](https://github.com/davidxuuts/yii2-imperavi-widget)[ RSS](/packages/davidxu-yii2-imperavi-widget/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (4)Versions (45)Used By (0)

Imperavi Redactor Widget for Yii 2
==================================

[](#imperavi-redactor-widget-for-yii-2)

[![Latest Version](https://camo.githubusercontent.com/3671fe31cd3a9fcd29170c3340a8bd029c73100782e3961fc651c2caf7caa634/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f646176696478757574732f796969322d696d7065726176692d7769646765742e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/davidxuuts/yii2-imperavi-widget/releases)[![Software License](https://camo.githubusercontent.com/b60331a2084501dc07cf6d6964c0da58dd005d89c45cf3b28b4b22b60f5ec00f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4253442d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/af5e25314f97d9346db7be1bacd76cebec96f6f4258197d8576650e68df1c1d0/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f646176696478757574732f796969322d696d7065726176692d7769646765742f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/davidxuuts/yii2-imperavi-widget)[![Coverage Status](https://camo.githubusercontent.com/24520a6a3442e57b3ea178596310b9198683bd0b6d3c92e6453c2367329789b3/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f766f766130372f796969322d696d7065726176692d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/davidxuuts/yii2-imperavi-widget/code-structure)[![Quality Score](https://camo.githubusercontent.com/2dd91da75d34b76e23812db904e4869165891e74a1a582c6ad4d056894bac2d4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f646176696478757574732f796969322d696d7065726176692d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/davidxuuts/yii2-imperavi-widget)[![Total Downloads](https://camo.githubusercontent.com/b842868683bcf8e3aaabb9a8de8664fdae5670de080b4d579734c9eac935bca3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f646176696478757574732f796969322d696d7065726176692d7769646765742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/davidxuuts/yii2-imperavi-widget)

`Imperavi Redactor Widget` is a wrapper for [Imperavi Redactor 10.2.5](https://imperavi.com/assets/pdf/redactor-documentation-10.pdf), a high quality WYSIWYG editor.

**Note that Imperavi Redactor itself is a proprietary commercial copyrighted software but since Yii community bought OEM license you can use it for free with Yii.**

Install
-------

[](#install)

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

Either run

```
$ php composer.phar require --prefer-dist davidxu/yii2-imperavi-widget "*"
```

or add

```
"davidxu/yii2-imperavi-widget": "*"
```

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

Usage
-----

[](#usage)

If file/image info stores in DB or use qiniu bucket, please implement migrations below first:

```
yii migrate/up --migration-path @davidxu/imperavi/migrations/

```

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

### Like a widget

[](#like-a-widget)

```
echo \davidxu\imperavi\Redactor::widget([
    'name' => 'redactor',
    'settings' => [
        'lang' => 'zh_cn',
        'imageUpload' => '/api/v1/redactor/upload',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', 'red'],
            ['green', 'green'],
            ['blue', 'blue'],
        ],
    ],
]);
```

### Like an ActiveForm widget

[](#like-an-activeform-widget)

```
use davidxu\imperavi\Redactor;

echo $form->field($model, 'content')->widget(Redactor::class, [
    'settings' => [
        'lang' => 'zh_cn',
        'imageUpload' => '/api/v1/redactor/upload',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', 'red'],
            ['green', 'green'],
            ['blue', 'blue'],
        ],
    ],
]);
```

### Like a widget for a predefined textarea

[](#like-a-widget-for-a-predefined-textarea)

```
echo \davidxu\imperavi\Redactor::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'imageUpload' => '/api/v1/redactor/upload',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen',
        ],
        'clips' => [
            ['Lorem ipsum...', 'Lorem...'],
            ['red', 'red'],
            ['green', 'green'],
            ['blue', 'blue'],
        ],
    ],
]);
```

### Upload image

[](#upload-image)

```
// DefaultController.php
public function actions()
{
    return [
        'upload-local' => [
            'class' => 'davidxu\imperavi\actions\LocalUploadFileAction',
            'dnsBaseUrl' => 'http://my-site.com/', // Domain name or uri where files are stored, filelink will be dnsBaseUrl + url
            'url' => 'images/', // Directory URL address, where files are stored.
            'path' => '@alias/to/my/path', // Or absolute path to directory where files are stored.
            'modelClass' => Attachment::class, // Please use migration first, if file/image info stored in DB
            'storeInDB' => true, // Default true
        ],
        'upload-qiniu' => [
            'class' => 'davidxu\imperavi\actions\QiniuUploadFileAction',
            'dnsBaseUrl' => 'http://my-site.com/', // Qiniu DNS domain name, filelink will be dnsBaseUrl + url
            'url' => 'images/', // Qiniu key prefix, key will be url + filename.
            'modelClass' => Attachment::class, // Please use migration first
        ],
    ];
}

// View.php
echo \davidxu\imperavi\Redactor::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'imageUpload' => Url::to(['/default/image-upload']),
        'plugins' => [
            'imagemanager',
        ],
    ],
]);
```

### Add custom plugins

[](#add-custom-plugins)

```
echo \davidxu\imperavi\Redactor::widget([
    'selector' => '#my-textarea-id',
    'settings' => [
        'lang' => 'zh_cn',
        'minHeight' => 200,
        'plugins' => [
            'clips',
            'fullscreen'
        ]
    ],
    'plugins' => [
        'my-custom-plugin' => 'app\assets\MyPluginBundle',
    ],
]);
```

Testing
-------

[](#testing)

```
$ phpunit
```

Further Information
-------------------

[](#further-information)

Please, check the [Imperavi Redactor v10](https://imperavi.com/assets/pdf/redactor-documentation-10.pdf) documentation for further information about its configuration options.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Vasile Crudu](https://github.com/vova07)
- [David Xu](https://github.com/davidxuuts)
- [All Contributors](../../contributors)

License
-------

[](#license)

The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

Upgrade guide
-------------

[](#upgrade-guide)

Please check the [UPGRADE GUIDE](UPGRADE.md) for details.

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 78.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~56 days

Recently: every ~192 days

Total

44

Last Release

1916d ago

Major Versions

1.3.2 → 2.0.02017-12-04

### Community

Maintainers

![](https://www.gravatar.com/avatar/59e94d6d1e147e3ed702e4f3dcbeb3eca9a9b228ad58dc014530212e0a3f3ba5?d=identicon)[davidxuuts](/maintainers/davidxuuts)

---

Top Contributors

[![vova07](https://avatars.githubusercontent.com/u/2714082?v=4)](https://github.com/vova07 "vova07 (87 commits)")[![davidxuuts](https://avatars.githubusercontent.com/u/1892196?v=4)](https://github.com/davidxuuts "davidxuuts (6 commits)")[![maxmirazh33](https://avatars.githubusercontent.com/u/2692282?v=4)](https://github.com/maxmirazh33 "maxmirazh33 (4 commits)")[![onmotion](https://avatars.githubusercontent.com/u/12899080?v=4)](https://github.com/onmotion "onmotion (2 commits)")[![do6po](https://avatars.githubusercontent.com/u/23662926?v=4)](https://github.com/do6po "do6po (1 commits)")[![ElisDN](https://avatars.githubusercontent.com/u/1673552?v=4)](https://github.com/ElisDN "ElisDN (1 commits)")[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (1 commits)")[![aaiyo](https://avatars.githubusercontent.com/u/1450687?v=4)](https://github.com/aaiyo "aaiyo (1 commits)")[![jcvalerio](https://avatars.githubusercontent.com/u/2169894?v=4)](https://github.com/jcvalerio "jcvalerio (1 commits)")[![marcovtwout](https://avatars.githubusercontent.com/u/438046?v=4)](https://github.com/marcovtwout "marcovtwout (1 commits)")[![Sensetivity](https://avatars.githubusercontent.com/u/4289543?v=4)](https://github.com/Sensetivity "Sensetivity (1 commits)")[![SilverFire](https://avatars.githubusercontent.com/u/4499203?v=4)](https://github.com/SilverFire "SilverFire (1 commits)")[![hamrak](https://avatars.githubusercontent.com/u/5807028?v=4)](https://github.com/hamrak "hamrak (1 commits)")[![bocceli](https://avatars.githubusercontent.com/u/14825615?v=4)](https://github.com/bocceli "bocceli (1 commits)")[![bscheshirwork](https://avatars.githubusercontent.com/u/5769211?v=4)](https://github.com/bscheshirwork "bscheshirwork (1 commits)")[![codewec](https://avatars.githubusercontent.com/u/4204501?v=4)](https://github.com/codewec "codewec (1 commits)")

---

Tags

yii2extensionwidgetyiiwysiwygqiniuyii 2Redactorimperavi

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/davidxu-yii2-imperavi-widget/health.svg)

```
[![Health](https://phpackages.com/badges/davidxu-yii2-imperavi-widget/health.svg)](https://phpackages.com/packages/davidxu-yii2-imperavi-widget)
```

###  Alternatives

[vova07/yii2-imperavi-widget

The imperavi redactor widget for Yii 2 framework.

243979.7k40](/packages/vova07-yii2-imperavi-widget)[artkost/yii2-trumbowyg

The Trumbowyg WYSIWYG Editor widget for yii2 framework

2418.3k](/packages/artkost-yii2-trumbowyg)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
