wildphp / authenticator
该包已被弃用且不再维护。未建议替代包。
PHP编写的微型RBAC库
dev-master
2023-03-01 21:44 UTC
Requires
- php: >=7.2.0
- yoshi2889/collections: ^0.1 || ^0.2
- yoshi2889/validation-closures: ^0.2
Requires (Dev)
- phpunit/phpunit: ^8
- squizlabs/php_codesniffer: ^3.0
This package is auto-updated.
Last update: 2023-03-29 21:57:16 UTC
README
按照IRC标准格式化文本的微型库。
安装
安装此包,您需要 Composer。
$ composer require wildphp/irc-textformatter ^0.1
用法
格式化器作为一个实用类工作。它暴露以下方法
bold(string $text)
italic(string $text)
underline(string $text)
color(string $text, string $foreground, string $background = '')
(见下文支持的色彩)
除了上述基本方法外,还提供了一些更高级的方法
findColorByString(string $color)
- 返回基于可读输入的数字颜色代码的字符串('white' 返回 '00',见下表颜色)calculateStringColor(string $stringToColor)
- 返回基于字符串内容的颜色代码的数字字符串consistentStringColor(string $stringToColor)
- 同上,但预先将颜色应用于字符串
它还允许您从文本中去除各种格式元素
stripBold(string $text)
stripItalic(string $text)
stripUnderline(string $text)
stripColor(string $text)
颜色表
可读 | IRC颜色代码 |
---|---|
白色 |
00 |
黑色 |
01 |
蓝色 |
02 |
绿色 |
03 |
红色 |
04 |
棕色 |
05 |
紫色 |
06 |
橙色 |
07 |
黄色 |
08 |
青色 |
09 |
蓝绿色 |
10 |
浅绿 |
11 |
皇家蓝 |
12 |
粉红色 |
13 |
灰色 |
14 |
银色 |
15 |