PHPackages                             borales/yii2-medium-editor - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. borales/yii2-medium-editor

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

borales/yii2-medium-editor
==========================

Medium editor widget for Yii2

0.0.2(9y ago)48.9k↓50%1MITPHP

Since Nov 1Pushed 9y ago2 watchersCompare

[ Source](https://github.com/Borales/yii2-medium-editor)[ Packagist](https://packagist.org/packages/borales/yii2-medium-editor)[ Docs](https://github.com/Borales/yii2-medium-editor)[ RSS](/packages/borales-yii2-medium-editor/feed)WikiDiscussions master Synced 1mo ago

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

Medium Editor for Yii2
======================

[](#medium-editor-for-yii2)

[![Latest Version](https://camo.githubusercontent.com/3d418c0d11c19c18245e5113aa65a30c064fae98fff73c857cef3d08d25887bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f426f72616c65732f796969322d6d656469756d2d656469746f722e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://github.com/Borales/yii2-medium-editor/tags)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/3258a78c28e5b5bbb92965d6f019ce033dbc06b62b424f0cedba4665cac8b9f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f626f72616c65732f796969322d6d656469756d2d656469746f722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/borales/yii2-medium-editor)

Renders Medium.com WYSIWYG editor ([yabwe/medium-editor](https://github.com/yabwe/medium-editor)) widget.

- [Changelog](CHANGELOG.md)
- [Installation](#installation)
- [Assets](#assets)
- [Usage](#usage)
- [External plugins](#external-plugins)
- [Licence](#license)

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

[](#installation)

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

Either run

```
$ php composer.phar require "borales/yii2-medium-editor" "*"
```

or add

```
"borales/yii2-medium-editor": "*"

```

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

Assets
------

[](#assets)

> By default - this extension doesn't provide any source files for Medium Editor itself. It uses public CDN instead ([jsdelivr.com](http://www.jsdelivr.com/)). And by default - it uses the latest version of the Medium Editor plugin.

However, you can change these settings by checking the following configuration of your application (`config/main.php`):

```
return [
    // ... other settings
    'components' => [
        // ... other settings
        'assetManager' => [
            'bundles' => [
                'borales\medium\Asset' => [
                    // set `bootstrap` theme for Medium Editor widget as a default one
                    'theme' => 'bootstrap',
                    // switch Medium Editor sources from the "latest" to the specific version
                    'useLatest' => false,
                    // use specific version of Medium Editor plugin with "useLatest=false"
                    'cdnVersion' => '5.22.1',
                ],
            ]
        ],
    ]
]
```

> The default **specified** version for Medium Editor plugin is `5.22.1`.

In case if you want to use Medium Editor plugin from local sources - you can do that by adding `bower-asset/medium-editor` package to your `composer.json` file and adding this line to your local configuration:

```
return [
    // ... other settings
    'components' => [
        // ... other settings
        'assetManager' => [
            'bundles' => [
                'borales\medium\Asset' => [
                    // use Medium Editor plugin sources from this path
                    'sourcePath' => '@bower/medium-editor/dist',
                ],
            ]
        ],
    ]
]
```

Usage
-----

[](#usage)

### as a standalone widget for a Model

[](#as-a-standalone-widget-for-a-model)

```
echo \borales\medium\Widget::widget([
    'model' => $model,
    'attribute' => 'text',
]);
```

### as a standalone widget for a custom variable

[](#as-a-standalone-widget-for-a-custom-variable)

```
echo \borales\medium\Widget::widget([
    'name' => 'my_custom_var',
    'value' => 'Some custom text!',
]);
```

### as a widget with extra Medium Editor settings

[](#as-a-widget-with-extra-medium-editor-settings)

```
echo \borales\medium\Widget::widget([
    'model' => $model,
    'attribute' => 'text',
    'theme' => 'tim', // Set a theme for this specific widget
    'settings' => [
        'toolbar' => [
            'buttons' => ['bold', 'italic', 'quote'],
        ]
    ],
]);
```

> [Here](https://github.com/yabwe/medium-editor/blob/master/OPTIONS.md) you can check the full list of Medium Editor options.

### as an ActiveForm widget

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

```
echo $form->field($model, 'text')->widget(\borales\medium\Widget::className());
```

### as an ActiveForm widget with settings

[](#as-an-activeform-widget-with-settings)

```
echo $form->field($model, 'text')->widget(\borales\medium\Widget::className(), [
    'theme' => 'mani',
    'settings' => [
        'toolbar' => [
            'buttons' => ['bold', 'italic', 'quote'],
        ]
    ],
]);
```

### as an ActiveField method (via `MediumEditorTrait`)

[](#as-an-activefield-method-via-mediumeditortrait)

In case if you use your custom `ActiveField` class - you can use `MediumEditorTrait` in your class:

```
namespace app\components;

class ActiveField extends \yii\widgets\ActiveField
{
    use \borales\medium\MediumEditorTrait;
}
```

And after that - call `mediumEditor()` method to render Medium Editor widget like this (and you can also pass Medium Editor settings as in above examples):

```
echo $form->field($model, 'text')->mediumEditor()
```

External plugins
----------------

[](#external-plugins)

If you want to use external plugin, which does not refer to the toolbar button (such as [medium-editor-insert-plugin](https://github.com/orthes/medium-editor-insert-plugin)), you need to use `plugins` property of the Widget and pass your code like this:

```
echo $form->field($model, 'text')->widget(\borales\medium\Widget::className(), [
    'plugins' => [
        'mediumInsert' => '$(selector).mediumInsert({editor: editor});',
    ],
]);
```

> `selector` and `editor` variables will be passed to the callback inside of the Widget's render method.

License
-------

[](#license)

MIT License. Please see [License File](LICENSE) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~4 days

Total

2

Last Release

3472d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a7700b2f0b477c2b60e3624bfd4aac000d5cb1d9e75e45a7f99ede46c6fe1e2?d=identicon)[borales](/maintainers/borales)

---

Top Contributors

[![Borales](https://avatars.githubusercontent.com/u/1118933?v=4)](https://github.com/Borales "Borales (12 commits)")

---

Tags

yii2wysiwygmedium editor

### Embed Badge

![Health badge](/badges/borales-yii2-medium-editor/health.svg)

```
[![Health](https://phpackages.com/badges/borales-yii2-medium-editor/health.svg)](https://phpackages.com/packages/borales-yii2-medium-editor)
```

###  Alternatives

[yiidoc/yii2-redactor

Extension redactor for Yii2 Framework.

191618.8k47](/packages/yiidoc-yii2-redactor)[bizley/quill

Quill editor implementation for Yii 2.

64133.3k5](/packages/bizley-quill)[bizley/contenttools

ContentTools editor implementation for Yii 2.

8016.7k](/packages/bizley-contenttools)

PHPackages © 2026

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