PHPackages                             yiipress/highlighter - 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. yiipress/highlighter

ActivePhp-ext[Utility &amp; Helpers](/categories/utility)

yiipress/highlighter
====================

Native PHP extension for fast server-side syntax highlighting with syntect

1.0.1(1mo ago)158↓46.6%BSD-3-ClauseRustPHP &gt;=8.1CI passing

Since May 3Pushed 1mo agoCompare

[ Source](https://github.com/yiipress/highligher)[ Packagist](https://packagist.org/packages/yiipress/highlighter)[ RSS](/packages/yiipress-highlighter/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

 [ ![YiiPress Highlighter](./logo.svg) ](https://github.com/yiipress)

YiiPress Highlighter PHP Extension
==================================

[](#yiipress-highlighter-php-extension)

[![Latest Stable Version](https://camo.githubusercontent.com/e4a0d130f8c66a188f86e357ad10d60ceda836cc6369ac3b628c70f1590bcfed/68747470733a2f2f706f7365722e707567782e6f72672f79696970726573732f686967686c6967687465722f76)](https://packagist.org/packages/yiipress/highlighter)[![Total Downloads](https://camo.githubusercontent.com/7f7c3f346b21ed3b0eb8a08ed452033b7ca3ecb6a8dee40581ad6865e7d78f61/68747470733a2f2f706f7365722e707567782e6f72672f79696970726573732f686967686c6967687465722f646f776e6c6f616473)](https://packagist.org/packages/yiipress/highlighter)[![Tests](https://github.com/yiipress/highligher/actions/workflows/tests.yml/badge.svg)](https://github.com/yiipress/highligher/actions/workflows/tests.yml)[![Windows](https://github.com/yiipress/highligher/actions/workflows/windows.yml/badge.svg)](https://github.com/yiipress/highligher/actions/workflows/windows.yml)

The package provides a native PHP extension for fast server-side syntax highlighting powered by [syntect](https://github.com/trishume/syntect/).

Requirements
------------

[](#requirements)

- PHP 8.1 - 8.5.
- [PIE](https://github.com/php/pie) to install the extension.
- On Linux and macOS: `cargo`, `phpize`, `php-config`, C compiler, and `make`.

Prebuilt Windows DLLs are attached to GitHub releases.

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

[](#installation)

Install the extension with PIE:

```
pie install yiipress/highlighter
```

PIE installs the native extension into the target PHP installation. If the extension is not enabled automatically, add it to your `php.ini`:

```
extension=highlighter
```

In an application, use Composer to declare that the extension must be available:

```
composer require ext-highlighter:*
```

Composer does not build or enable native PHP extensions, so `composer require yiipress/highlighter` is not an installation substitute for PIE.

General usage
-------------

[](#general-usage)

Highlight an HTML fragment containing code blocks in the form `...`:

```
