iamjohndev/highlight
Composer 安装命令:
composer require iamjohndev/highlight
包简介
A PHP class for highlighting code using highlight.js library.
README 文档
README
HighLightPHP is a PHP class library that enables syntax highlighting for code snippets using the Highlight.js library directly in your PHP code.
Installation
You can install HighLightPHP using Composer. Just run the following command:
composer require iamjohndev/highlight:dev-main
Usage
use iamjohndev\HighLightPHP; $highlighter = new HighLightPHP(); $code = 'echo "Hello, world!";'; $language = 'php'; $style = 'github-dark'; $highlighted_code = $highlighter->highlightCode($code, $language, $style); echo $highlighted_code; // or $highlighted_code = $highlighter->highlightCode('<?php echo "hello highlight php"?> ', 'php', 'github-dark'); echo $highlighted_code;
In addition to supporting all types of themes and languages from the Highlight JS library, HighLightPHP offers a simple and convenient way to add syntax highlighting to your PHP projects. It allows you to easily load the necessary language and style files, combine them with the Highlight.js library, and execute code highlighting on your code snippets.
With HighLightPHP, you can highlight code snippets in various programming languages, including PHP, JavaScript, HTML, CSS, Python, Java, Ruby, and many more. You can also choose from a wide range of pre-built styles, such as Github, Solarized, Monokai, and many others.
By using HighLightPHP in your projects, you can improve the readability of your code snippets and make it easier for your users to understand the code.
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-04-21