PHP code example of ratipriya / php-highlight-example

1. Go to this page and download the library: Download ratipriya/php-highlight-example 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/ */

    

ratipriya / php-highlight-example example snippets




atipriya\PHPHighlight\ColorsDto;
use Ratipriya\PHPHighlight\Highlighter;

$text = '


abstract class AbstractClass
{
    /**
     * Our abstract method only needs to define the  the parent\'s signature
     */
    public function prefixName(string $name): string
    {
        if ($name === "Pacman") {
            $prefix = "Mr.";
        } else {
            $prefix = "Mrs.";
        }
        
        return $prefix . " " . $name;
    }
}

$class = new ConcreteClass;
echo $class->prefixName("Pacman"), "\n";
echo $class->prefixName("Pacwoman"), "\n";
';

$vs2015 = new ColorsDto(
    '#DCDCDC',
    '#1E1E1E',
    '#57A64A',
    '#fbc201',
    '#569CD6; font-weight: bold',
    '#D69D85'
);

$highlighter = new Highlighter($text, $vs2015);
echo $highlighter->highlight();
bash
composer