PHPackages                             graftype/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. graftype/php-highlight

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

graftype/php-highlight
======================

A PHP library for highlighting code syntax.

1.0.14(9mo ago)017MITPHPPHP &gt;=7.4

Since Sep 24Pushed 9mo agoCompare

[ Source](https://github.com/graftype/php-highlight)[ Packagist](https://packagist.org/packages/graftype/php-highlight)[ RSS](/packages/graftype-php-highlight/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (16)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 &lt;pre&gt; tag, reads the attributes (data-lang, data-file, data-theme) and highlights the syntax of the code block.

Supports style customization. Here are examples of styling:

[![styling example](https://camo.githubusercontent.com/76138e8fc67cb2cc0acbecc76c1c0bfc91b7a3b028ba19c9ebbe95700aa68fd8/68747470733a2f2f64656d79616e6f762e6465762f73697465732f64656661756c742f66696c65732f696d616765732f706870686967686c69676874322e706e67)](https://camo.githubusercontent.com/76138e8fc67cb2cc0acbecc76c1c0bfc91b7a3b028ba19c9ebbe95700aa68fd8/68747470733a2f2f64656d79616e6f762e6465762f73697465732f64656661756c742f66696c65732f696d616765732f706870686967686c69676874322e706e67)

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

[](#requirements)

PHP 8.1+

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

[](#installation)

You can install package via composer

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

Usage
-----

[](#usage)

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

```
