https://github.com/ghostff/php_prettify
Outputs or returns html markup for a syntax highlighted version of the given PHP code
https://github.com/ghostff/php_prettify
php php-prettify
Last synced: about 1 year ago
JSON representation
Outputs or returns html markup for a syntax highlighted version of the given PHP code
- Host: GitHub
- URL: https://github.com/ghostff/php_prettify
- Owner: Ghostff
- License: mit
- Created: 2016-05-04T02:36:42.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2021-12-04T02:45:05.000Z (over 4 years ago)
- Last Synced: 2024-04-26T06:22:12.180Z (about 2 years ago)
- Topics: php, php-prettify
- Language: HTML
- Homepage: https://goo.gl/3pRbrP
- Size: 184 KB
- Stars: 12
- Watchers: 3
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP Prettify
Creates a syntax highlighted version of the given PHP code.
```bash
# PHP 8
composer require ghostff/php_prettify
# Older PHP version
composer require ghostff/php_prettify:5.4.093021
composer require ghostff/php_prettify:7.0.093021
```
```php
', (new Highlight)->render('$name = "foobar"'), '';
````
#### Highlighting a file
```php
', (new Highlight)
->setTheme('bittr') // Sets code highlight theme.
->setStyle('body {margin:0;padding:0}') // Append css to default to style.
->setHighlight(22, ['style' => 'color:red']) // Add html attributes to selected line(tr).
->showLineNumber(1, false) // Show line number starting from line 1 and prevent selection of line number.
->render('code.txt', true),
'';
```
