PHPackages                             coderius/yii2-highlight-js - 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. coderius/yii2-highlight-js

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

coderius/yii2-highlight-js
==========================

Syntax highlighter widget for Yii2

1.0.0(8y ago)0226↓75%MITPHP

Since Apr 17Pushed 8y agoCompare

[ Source](https://github.com/coderius/yii2-highlight-js)[ Packagist](https://packagist.org/packages/coderius/yii2-highlight-js)[ RSS](/packages/coderius-yii2-highlight-js/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Syntax highlighter widget for Yii2
==================================

[](#syntax-highlighter-widget-for-yii2)

[![Latest Stable Version](https://camo.githubusercontent.com/5ae78c9aff2d7bdd9dbeeb2336dbc67c0a2572174aae6218f6db32208c1f4026/68747470733a2f2f706f7365722e707567782e6f72672f636f6465726975732f796969322d686967686c696768742d6a732f762f737461626c65)](https://packagist.org/packages/coderius/yii2-highlight-js)[![Total Downloads](https://camo.githubusercontent.com/ad5180277b26c231d8b24ebee71db5880454da580831e1295fa2112798624532/68747470733a2f2f706f7365722e707567782e6f72672f636f6465726975732f796969322d686967686c696768742d6a732f646f776e6c6f616473)](https://packagist.org/packages/coderius/yii2-highlight-js)[![Latest Unstable Version](https://camo.githubusercontent.com/d8c6c26db5bc3019639ddbc6127551a999232c3144bab86269e0113806d68075/68747470733a2f2f706f7365722e707567782e6f72672f636f6465726975732f796969322d686967686c696768742d6a732f762f756e737461626c65)](https://packagist.org/packages/coderius/yii2-highlight-js)[![License](https://camo.githubusercontent.com/b3134565207be483d4ef8d97821afc16f8a4eb6de6d8ec8591b19fa330390ac5/68747470733a2f2f706f7365722e707567782e6f72672f636f6465726975732f796969322d686967686c696768742d6a732f6c6963656e7365)](https://packagist.org/packages/coderius/yii2-highlight-js)[![Monthly Downloads](https://camo.githubusercontent.com/851061d4d89504e65ab8cb1fcb7ee28a6ed927ad2ce876c2b077f6fce4668c19/68747470733a2f2f706f7365722e707567782e6f72672f636f6465726975732f796969322d686967686c696768742d6a732f642f6d6f6e74686c79)](https://packagist.org/packages/coderius/yii2-highlight-js)

This widget is for the yii2 framework. This is a wrapper for the javascript plugin Highlight.js.

If you post the code as part of the content on the website, then with this widget your code will look stylish.

In the pictures below you can see examples of how the code will look on the website pages.

[![](Screenshot.png)](Screenshot.png)

'Xcode' theme.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist coderius/yii2-highlight-js "*"

```

or add

```
"coderius/yii2-highlight-js": "*"

```

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

Usage
-----

[](#usage)

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

```

```

Some code that needs to be formalized with the plugin must be framed in the block :

```

...some code

```

If You need to change the styles of the code block, you can attach your styles in this way.

```

```

In this example I did my custom asset (as example codev\\yii2\_highlight\_js\\NumLineAsset::className()) It contains paths to styles and scripts to change the style HighlightWidget.

Advensed example:

```
