noccylabs/highlighter

$ git tag


$ git branch
* master

NoccyLabs Highlighter

This is a library to highlight data in various formats such as xml and json.

Usage

use NoccyLabs\Highlighter\Dumper;
use NoccyLabs\Highlighter\Formatter\AnsiFormatter;
use NoccyLabs\Highlighter\Formatter\HtmlFormatter;

// The input data is text data in a supported format
$json = file_get_contents("file.json");
$xml = file_get_contents("file.xml");

// The ansiformatter generates ansi...
$ansiDumper = new Dumper(new AnsiFormatter());
echo $ansiDumper->dump($json, "json");

// And the htmlformatter generates .....
$htmlDumper = new Dumper(new HtmlFormatter());
echo $htmlDumper->dump($json, "json");

// The second parameter specifies the lexer to use
echo $ansiDumper->dump($xml, "xml");