Details
PHP Prettify
Outputs or returns html markup for a syntax highlighted version of the given PHP code using your defined colors.
includes PHP 7.1 version
<?php
use PhpPrettify\Highlight;
/*
* @param (string) file name or string of PHP code to be highlighted
* @param (bool) set to true if @param1 is a file
* @param (bool) allow caching of processed text (currently work for files only)
*/
echo '<pre>', Highlight::render('code.txt', true, true), '</pre>';
showLineNumber
/
* @param (bool) displays line number if true.
* @param (int) line at wich code rendering begins.
* @return (void)
*/
Highlight::showLineNumber($flag, $start_line);
theme
/
* @param (string) name of theme base on json file.
* @param (string) default theme to use if @param1 was not found.
* @return (int) (2 used @param1, 1 used @param2, 0 none, -1 no theme.json file found)
*/
Highlight::showLineNumber($flag, $start_line);
setHighlight
/
* @param (int) line to highlight
* @param (array) attributes to add to line eg (array('class' => 'clsName'))
* @param (bool) allows only one(last called) highlight.
*/
Highlight::setHighlight($line, array $attributes, $override);
|
Name: |
PHP Prettify |
Base name: |
php_prettify |
Description: |
Output colored PHP code highlighted using themes |
Version: |
- |
PHP version: |
5 |
License: |
BSD License |
|
|
August 2020
Nominee
Vote |
PHP comes with built-in support to parse PHP code to generate HTML that can display the code in a highlighted format using color.
This package implements a better solution for displaying PHP code in Web pages.
It can highlight the code using colors, add line numbering, highlight specific lines or just part of the code of a script, and highlighting the code using themes configured using separate files in JSON format.
Manuel Lemos |
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.
|
Files |
|