PHPackages                             demyanovs/php-highlight - 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. demyanovs/php-highlight

ActiveLibrary

demyanovs/php-highlight
=======================

A PHP library for highlighting code syntax.

3.0.0(5mo ago)94.5k↓17.6%1MITPHPPHP &gt;=8.1CI passing

Since May 30Pushed 5mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (3)Versions (8)Used By (0)

PHPHighlight
============

[](#phphighlight)

PHPHighlight is a PHP syntax highlighting library that can be easily customized and extended.

How it works
------------

[](#how-it-works)

The library parses the text, finds the `` and `` tags, reads the attributes (data-lang, data-file, data-theme) and highlights the syntax of the code block.

**Recommended:** Use `` pattern for better semantics and compatibility with Markdown output.

Supports style customization. Here are examples of styling:

[![styling example](examples/img/scr_01.png)](examples/img/scr_01.png)

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

[](#requirements)

PHP 8.1+

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

[](#installation)

You can install package via composer

```
$ composer require demyanovs/php-highlight
```

Usage
-----

[](#usage)

See full example in [examples/index.php](examples/index.php)

```
