PHPackages                             dominus77/yii2-highlight-plugin - 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. dominus77/yii2-highlight-plugin

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

dominus77/yii2-highlight-plugin
===============================

Yii2 Syntax highlighting with support for line numbering for the Web.

v1.1.2(8y ago)21.1k↓84.4%[1 issues](https://github.com/Dominus77/yii2-highlight-plugin/issues)BSD-3PHP

Since Oct 4Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Dominus77/yii2-highlight-plugin)[ Packagist](https://packagist.org/packages/dominus77/yii2-highlight-plugin)[ RSS](/packages/dominus77-yii2-highlight-plugin/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (6)Used By (0)

yii2-highlight-plugin
=====================

[](#yii2-highlight-plugin)

[![Latest Stable Version](https://camo.githubusercontent.com/dfe6e9cb6ae5f5e536c61ba07ee373c2ff96be7372e7ee3eb92c7b2d89f24078/68747470733a2f2f706f7365722e707567782e6f72672f646f6d696e757337372f796969322d686967686c696768742d706c7567696e2f762f737461626c65)](https://packagist.org/packages/dominus77/yii2-highlight-plugin)[![License](https://camo.githubusercontent.com/8040e496484377bd380393cc62eabe6b7dc191a24090e6f56070847464a31349/68747470733a2f2f706f7365722e707567782e6f72672f646f6d696e757337372f796969322d686967686c696768742d706c7567696e2f6c6963656e7365)](https://github.com/Dominus77/yii2-highlight-plugin/blob/master/LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b44264416dda53eabf71f86c6c05d42444918cfcd4a16f15a7837ec158955db2/68747470733a2f2f7472617669732d63692e6f72672f446f6d696e757337372f796969322d686967686c696768742d706c7567696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Dominus77/yii2-highlight-plugin)[![codecov](https://camo.githubusercontent.com/ecfc9dba2e6202143a97e9c5ba130406375bb3d4f1cb8c5584cb06cbd346feb3/68747470733a2f2f636f6465636f762e696f2f67682f446f6d696e757337372f796969322d686967686c696768742d706c7567696e2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Dominus77/yii2-highlight-plugin)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c563bbdf76d2c1b736a8ffde6cac74bd95c6dc2c78ee5015bd46286b0b076428/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f446f6d696e757337372f796969322d686967686c696768742d706c7567696e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Dominus77/yii2-highlight-plugin/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/6a30e342c2e78f5a15b4a83e10cb3c67c515a996e92f5a8f0f126b09be587993/68747470733a2f2f706f7365722e707567782e6f72672f646f6d696e757337372f796969322d686967686c696768742d706c7567696e2f646f776e6c6f616473)](https://packagist.org/packages/dominus77/yii2-highlight-plugin)[![PayPal donate button](https://camo.githubusercontent.com/0d6e4d8b50b5983a58205941b1a581b1305903393b7a39da574e3f60af3c7f5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f70617970616c2d646f6e6174652d79656c6c6f772e737667)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RMSNEVJL7CGKJ "Donate once-off to this project using Paypal")[![SensioLabsInsight](https://camo.githubusercontent.com/58f20f87c9a6801072631857a798ebc19856ab4cd2c5c8fd8606b70134a60cc3/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f32346566313239382d373534652d343038312d623334342d6266353231366232323263642f6d696e692e706e67)](https://insight.sensiolabs.com/projects/24ef1298-754e-4081-b344-bf5216b222cd)

Yii2 Syntax highlighting with support for line numbering for the Web.

176 languages and 79 styles

The plugin is based on [highlight.js](https://highlightjs.org/), added support for line numbering with the plugin [highlightjs-line-numbers.js](https://github.com/wcoder/highlightjs-line-numbers.js)

Auto language definition

```
...

```

Explicit language specification

```
...
...
...
...

```

Add class hljs, render full block code

```
...
...
...
...

```

Watch [demo](https://highlightjs.org/static/demo/)

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

[](#installation)

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

Either run

```
php composer.phar require dominus77/yii2-highlight-plugin "*"

```

or add

```
"dominus77/yii2-highlight-plugin": "*"

```

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

Usage
-----

[](#usage)

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

```
