PHPackages                             conquer/codemirror - 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. conquer/codemirror

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

conquer/codemirror
==================

Yii2 codemirror widget

2.0.2(3y ago)36289.4k↓35.3%14[4 issues](https://github.com/borodulin/yii2-codemirror/issues)3MITPHPPHP &gt;=5.4.0

Since Apr 10Pushed 1y ago2 watchersCompare

[ Source](https://github.com/borodulin/yii2-codemirror)[ Packagist](https://packagist.org/packages/conquer/codemirror)[ Docs](https://github.com/borodulin/yii2-codemirror)[ RSS](/packages/conquer-codemirror/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (6)Dependencies (3)Versions (7)Used By (3)

Codemirror widget for Yii2 framework
====================================

[](#codemirror-widget-for-yii2-framework)

Description
-----------

[](#description)

CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality. For more information please visit [CodeMirror](http://codemirror.net/)

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

[](#installation)

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

To install, either run

```
$ php composer.phar require conquer/codemirror "*"

```

or add

```
"conquer/codemirror": "*"

```

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

Usage
-----

[](#usage)

```
use conquer\codemirror\CodemirrorWidget;

$form->field($model, 'code')->widget(
    CodemirrorWidget::className(),
    [
        'preset'=>'php',
        'options'=>['rows' => 20],
    ]
);
```

You can use ready-made presets, or create your own. To do this, specify the folder to your presets.

```
use conquer\codemirror\CodemirrorWidget;

$form->field($model, 'code')->widget(
    CodemirrorWidget::className(),
    [
        'presetsDir'=>'/path_to_your_presets',
        'preset'=>'sql',
    ]
);
```

In general, you can customize the widget directly specifying its properties.

```
use conquer\codemirror\CodemirrorWidget;
use conquer\codemirror\CodemirrorAsset;

$form->field($model, 'code')->widget(
    CodemirrorWidget::className(),
    [
        'assets'=>[
            CodemirrorAsset::MODE_CLIKE,
            CodemirrorAsset::KEYMAP_EMACS,
            CodemirrorAsset::ADDON_EDIT_MATCHBRACKETS,
            CodemirrorAsset::ADDON_COMMENT,
            CodemirrorAsset::ADDON_DIALOG,
            CodemirrorAsset::ADDON_SEARCHCURSOR,
            CodemirrorAsset::ADDON_SEARCH,
        ],
        'settings'=>[
            'lineNumbers' => true,
            'mode' => 'text/x-csrc',
            'keyMap' => 'emacs'
        ],
    ]
);
```

##### JavaScript

[](#javascript)

For access the instance of CodeMirror from JavaScript, you can use CodeMirror.instances\[\] . Example:

```
    var instanceName = document.getElementById('textarea-id').dataset.codeMirror;

    var cm = CodeMirror.instances[instanceName];

    var code = cm.getValue();   // Get the current editor content
    /*
        cm.save();              // Copy the content of the editor into the textarea
        cm.toTextArea();        // Remove the editor, and restore the original textarea
    */
```

License
-------

[](#license)

**conquer/codemirror** is released under the MIT License. See the bundled `LICENSE.md` for details.

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community24

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 86.6% 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 ~531 days

Recently: every ~662 days

Total

6

Last Release

1446d ago

Major Versions

1.2 → 2.02015-10-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/67126642d0e8ae8837b3104dcd120f7992ed0837538a7d140914e17420eb17c2?d=identicon)[borodulin](/maintainers/borodulin)

---

Top Contributors

[![borodulin](https://avatars.githubusercontent.com/u/8121448?v=4)](https://github.com/borodulin "borodulin (58 commits)")[![iz65535](https://avatars.githubusercontent.com/u/883830?v=4)](https://github.com/iz65535 "iz65535 (3 commits)")[![chuprik](https://avatars.githubusercontent.com/u/802946?v=4)](https://github.com/chuprik "chuprik (1 commits)")[![elisevgeniy](https://avatars.githubusercontent.com/u/2894331?v=4)](https://github.com/elisevgeniy "elisevgeniy (1 commits)")[![royalrex](https://avatars.githubusercontent.com/u/263403?v=4)](https://github.com/royalrex "royalrex (1 commits)")[![axtho](https://avatars.githubusercontent.com/u/11181579?v=4)](https://github.com/axtho "axtho (1 commits)")[![sitedevpro](https://avatars.githubusercontent.com/u/23181481?v=4)](https://github.com/sitedevpro "sitedevpro (1 commits)")[![BBrunekreeft](https://avatars.githubusercontent.com/u/9114578?v=4)](https://github.com/BBrunekreeft "BBrunekreeft (1 commits)")

---

Tags

yii2extensionwidgetcodemirror

### Embed Badge

![Health badge](/badges/conquer-codemirror/health.svg)

```
[![Health](https://phpackages.com/badges/conquer-codemirror/health.svg)](https://phpackages.com/packages/conquer-codemirror)
```

###  Alternatives

[conquer/select2

Yii2 Select2 widget

1682.0k4](/packages/conquer-select2)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1359.3k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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