PHP code example of kelunik / highlight

1. Go to this page and download the library: Download kelunik/highlight library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kelunik / highlight example snippets




$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(" print 'Hello World';");
bash
bin/highlight /path/to/file.php
bash
bin/highlight-html /path/to/file.php > out.html