Download the PHP package kuria/php-highlighter without Composer
On this page you can find all versions of the php package kuria/php-highlighter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download kuria/php-highlighter
More information about kuria/php-highlighter
Files in kuria/php-highlighter
Download kuria/php-highlighter
More information about kuria/php-highlighter
Files in kuria/php-highlighter
Please rate this library. Is it a good library?
Informations about the package php-highlighter
PHP highlighter ###############
PHP code highlighter.
Features
- highlighting files or strings
- highlighting specific line ranges
- marking an active line
- produces an ordered list (
<ol>
) with corresponding line numbers
Requirements
- PHP 7.1+
Usage
Highlighting code
PhpHighlighter::file()
- highlight a PHP filePhpHighlighter::code()
- highlight a string of PHP code $php = <<<'PHP' <?php echo "Hello world!"; PHP; echo PhpHighlighter::code($php);
Output:
html
<ol> <li><span style="color: #0000BB"><?php</span></li> <li></li> <li><span style="color: #007700">echo </span><span style="color: #DD0000">"Hello world!"</span><span style="color: #007700">;</span></li> <li></li> </ol>
Marking an active line
An active line can be specified using the second argument.
The active line will have a class="active"
attribute.
Specifying line range
A line range can be specified using the third argument.
Example line ranges:
NULL
- highlight all lines[20, 30]
- highlight lines from 20 to 30 (absolute)[-5, 5]
- highlight 5 lines around the active line (requires active line)[0, 0]
- highlight the active line only (requires active line) php <?php echo PhpHighlighter::code($php, 3, [-1, 1]);
All versions of php-highlighter with dependencies
PHP Build Version
Package Version
The package kuria/php-highlighter contains the following files
Loading the files please wait ....