https://github.com/mkgor/highlighter
Library, which allows you to highlight your PHP code in console (terminal)
https://github.com/mkgor/highlighter
ascii code composer-package highlight php syntax syntax-highlighting terminal
Last synced: about 1 month ago
JSON representation
Library, which allows you to highlight your PHP code in console (terminal)
- Host: GitHub
- URL: https://github.com/mkgor/highlighter
- Owner: mkgor
- Created: 2020-04-26T12:50:55.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-30T19:02:24.000Z (over 5 years ago)
- Last Synced: 2025-01-19T21:48:27.397Z (about 1 year ago)
- Topics: ascii, code, composer-package, highlight, php, syntax, syntax-highlighting, terminal
- Language: PHP
- Homepage:
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Highlighter
Library, which allows you to highlight your PHP code in terminal
## Installation
Installation via composer:
````
composer require mkgor/highlighter
````
## Printing whole file
````php
getWholeFile(__FILE__);
````
#### Result

## Printing code snippet (and highlighting specified line)
````php
getSnippet(__FILE__, 3);
````
#### Result

## Printing code snippet with specified lines
````php
getSpecifiedSnippet(__FILE__, 3, 5);
````
#### Result

## Printing single line
````php
getLine(__FILE__, 3);
````
#### Result

##
You can use same functions with suffix `WithoutNumbers` to highlight code without line numbers:
```php
getWholeFileWithoutNumbers(__FILE__);
```
#### Result

## Themes
This highlighter supports custom themes. It has built-in themes, but you can create your own by implementing ```Highlighter\Theme\ThemeInterface```
So, to set theme, just call ```setTheme``` method of Highlighter
```php
setTheme(new Highlighter\Theme\DefaultThemes\Minimalistic());
echo $highlighter->getWholeFile(__FILE__);
```
#### Built-in themes:
##### Minimalistic

##### Light

##### Material
