定制 decodelabs/enlighten 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

decodelabs/enlighten

最新稳定版本:v0.9.4

Composer 安装命令:

composer require decodelabs/enlighten

包简介

PHP source highlighter

README 文档

README

PHP from Packagist Latest Version Total Downloads GitHub Workflow Status PHPStan License

PHP source highlighter

Enlighten provides exhaustive and accurate PHP source highlighting for use in debugging systems.

Installation

This package requires PHP 8.4 or higher.

Install via Composer:

composer require decodelabs/enlighten

Usage

Enlighten uses the PHP tokenizer extension which requires the full source from file (including <?php open tag).

It is effectively a more thorough version of highlight_string and highlight_file - grammar is properly wrapped and name entities are parsed according to their surrounding tokens to work out what type they are (function name, class name, etc, etc).

Enlighten also offers the ability to extract certain portions of the code and focus on a specific line. Line numbers are included in the output HTML to aid in readability.

use DecodeLabs\Enlighten\Highlighter;

$highlighter = new Highlighter();
echo $highlighter->highlight($phpSourceCode); // Highlight source code in memory
echo $highlighter->highlightFile($phpFile, 15, 35, 20); // Highlight specific lines (15 to 35) in file (focus on 20)

echo $highlighter->extract($phpSourceCode, 20); // Extract code around specific line
echo $highlighter->extractFromFile($phpFile, 20); // Extract code around specific line

Licensing

Enlighten is licensed under the MIT License. See LICENSE for the full license text.

统计信息

  • 总下载量: 22.23k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 4
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-09-29