1. Go to this page and download the library: Download geekdevs/highlight.php 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/ */
geekdevs / highlight.php example snippets
// Instantiate the Highlighter.
$hl = new Highlight\Highlighter();
$code = file_get_contents('some_ruby_script.rb');
try {
// Highlight some code.
$highlighted = $hl->highlight('ruby', $code);
echo "<pre class=\"hljs {$highlighted->language}\">\n";
echo $highlighted->value . "\n";
echo "</pre>\n";
}
catch (DomainException $e) {
// This is thrown if the specified language does not exist
echo "<pre>\n";
echo $code . "\n";
echo "</pre>\n";
}