Introducing a small library I wrote over the weekend which prints syntax highlighted (colored) PHP code into the terminal.
You can use it in any PHP CLI applications to pretty print PHP code OR to take screenshot of code and use somewhere.
Right now screenshot is manual process but it will soon be automated into this library so you can save a PNG image of your code.
Installation
$ composer require adhocore/cli-syntax
Usage
use Ahc\CliSyntax\Highlighter;
// PHP code
echo new Highlighter('<?php echo "Hello world!";');
// OR
echo (new Highlighter)->highlight('<?php echo "Hello world!";');
// PHP file
echo Highlighter::for('/path/to/file.php');
adhocore
/
php-cli-syntax
PHP Code Syntax Highlighter for CLI
adhocore/cli-syntax
Installation
composer require adhocore/cli-syntax
Usage
use Ahc\CliSyntax\Highlighter;
// PHP code
echo new Highlighter('<?php echo "Hello world!";');
// OR
echo (new Highlighter)->highlight('<?php echo "Hello world!";');
// PHP file
echo Highlighter::for('/path/to/file.php');
See example. Here's the screenshot too:
Contributing
Please check the guide.
LICENSE
© MIT | 2019, Jitendra Adhikari
Credits
This project is bootstrapped by phint and releases managed by please.
Feedbacks and contributions are welcome. Thank you.
Top comments (1)
I use Vim syntax highlighter.