jakub-onderka/php-console-highlighter
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
Jakub-Onderka/PHP-Console-Highlighter is a unique tool that accentuates your PHP code in your console or terminal environment. It allows you to highlight your PHP code, making it easier to differentiate between different parts of your script. This can be especially useful during debugging sessions, where identifying specific segments of your code quickly is critical.
Utilizing the jakub-onderka/php-console-highlighter is straightforward and easy. For starters, you need to create a composer.json
file and run the php composer.phar install
command to install the package:
{
"require": {
"jakub-onderka/php-console-highlighter": "0.*"
}
}
Once installed, you can use it in your PHP scripts like this:
<?php
use JakubOnderka\PhpConsoleColor\ConsoleColor;
use JakubOnderka\PhpConsoleHighlighter\Highlighter;
require __DIR__ . '/vendor/autoload.php';
$highlighter = new Highlighter(new ConsoleColor());
$fileContent = file_get_contents(__FILE__);
echo $highlighter->getWholeFile($fileContent);
With this code, a new instance of the Highlighter
class is created using the ConsoleColor
class. The content of the current file is then retrieved using the file_get_contents
function, and finally, the entire file's content is displayed with syntax highlighting using the getWholeFile
method of the Highlighter
instance.
The official Jakub-Onderka/PHP-Console-Highlighter documentation can be found directly on its GitHub page. Although the repository does not have a designated 'docs' section, the ReadMe file provides a succinct guide to installing and using the package. Visit https://github.com/JakubOnderka/PHP-Console-Highlighter for the original and most up-to-date resource.