定制 ratipriya/php-highlight-example 二次开发

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

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

ratipriya/php-highlight-example

最新稳定版本:1.0.2

Composer 安装命令:

composer require ratipriya/php-highlight-example

包简介

A PHP library for highlighting code syntax.

README 文档

README

A PHP library for highlighting code syntax.

Installation

composer require ratipriya/php-highlight-example

Usage

<?php

require_once __DIR__.'/vendor/autoload.php';

use Ratipriya\PHPHighlight\ColorsDto;
use Ratipriya\PHPHighlight\Highlighter;

$text = '
<?php

abstract class AbstractClass
{
    /**
     * Our abstract method only needs to define the required arguments
     */
    abstract protected function prefixName(string $name): string;
}

class ConcreteClass extends AbstractClass
{
    /**
     * Our child class may define optional arguments not in the parent\'s signature
     */
    public function prefixName(string $name): string
    {
        if ($name === "Pacman") {
            $prefix = "Mr.";
        } else {
            $prefix = "Mrs.";
        }
        
        return $prefix . " " . $name;
    }
}

$class = new ConcreteClass;
echo $class->prefixName("Pacman"), "\n";
echo $class->prefixName("Pacwoman"), "\n";
';

$vs2015 = new ColorsDto(
    '#DCDCDC',
    '#1E1E1E',
    '#57A64A',
    '#fbc201',
    '#569CD6; font-weight: bold',
    '#D69D85'
);

$highlighter = new Highlighter($text, $vs2015);
echo $highlighter->highlight();

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-26