PHP code example of yiipress / highlighter

1. Go to this page and download the library: Download yiipress/highlighter 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/ */

    

yiipress / highlighter example snippets




declare(strict_types=1);

use YiiPress\Highlighter;

$highlighter = new Highlighter();

$html = $highlighter->highlightHtml(
    '<pre><code class="language-php">&lt;?php echo "Hello";</code></pre>',
);



declare(strict_types=1);

use YiiPress\Highlighter;

$highlighter = new Highlighter();

$html = $highlighter->highlight('echo "Hello";', 'php');



declare(strict_types=1);

use YiiPress\Highlighter;

$highlighter = new Highlighter('Solarized (dark)');



declare(strict_types=1);

use YiiPress\Highlighter;

$highlighter = new Highlighter();

$html = $highlighter->highlight($code, 'php', 'base16-mocha.dark');



declare(strict_types=1);

use YiiPress\Highlighter;

$highlighter = new Highlighter('/path/to/theme.tmTheme');
ini
extension=highlighter