PHP Syntax Highlighter

v0.1.0 2016-11-11 12:51 UTC

This package is auto-updated.

Last update: 2024-05-15 06:41:16 UTC


A (PHP) syntax highlighter written in PHP.


$hl = new Kelunik\Highlight\Highlighter(new HtmlFormatter("php"));

// <optional>
$hl->addPreProcessor(new Your\Custom\PreProcessor);
$hl->addPostProcessor(new Your\Custom\PostProcessor);
// </optional>

print $hl->highlight("<?php print 'Hello World';");


These CLI scripts should give you some hints on how to use the API.

bin/highlight /path/to/file.php
bin/highlight-html /path/to/file.php > out.html

Supported Languages

Currently, only PHP is supported. But you could just add another Lexer.