chrismou/php-irc-text-formatting
Composer 安装命令:
composer require chrismou/php-irc-text-formatting
包简介
PHP library for adding color and styling to IRC text output
README 文档
README
PHP library for adding color and styling to IRC text output
About
This plugin is designed to provide IRC script writers a simple way to add colors/styles to their output. It should be compatible with most major PHP IRC bots, such as Phergie.
Install
The recommended method of installation is through composer.
composer require chrismou/php-irc-text-formatting
Configuration
To begin adding formatting to ouput text within your own applications, you'll need to include it in your project. The simplest way of doing this is as follows:
protected $format; function __construct(array $config=array()) { $this->format = new \Chrismou\Irc\TextFormatting\Format; ... }
Or, if you're only using it once, you can just include it directly in your method.
public function foo { $format = new \Chrismou\Irc\TextFormatting\Format; ... }
Usage
The 3 methods available are color, style and rainbow.
Color
This takes 3 parameters. First is the text, second is the text color, third is the background colour (optional).
$format = new \Chrismou\Irc\TextFormatting\Format; $format->color("This text will be red", "red"); $format->color("This text will be blue on a green background", "blue", "green");
Available color codes:
- white
- black
- blue
- green
- red
- brown
- purple
- orange
- yellow
- lightGreen
- teal
- cyan
- lightBlue
- pink
- grey
- lightGrey
Style
This takes 2 parameters. First is the text, second is the style to use.
$format = new \Chrismou\Irc\TextFormatting\Format; $format->style("This text will be underlined", "underline");
Available style codes:
- bold
- underline
- reverse (switches foreground and background color)
I've purposely excluded strikethrough and italic codes as support for them among IRC clients is fairly poor.
Rainbow
This takes a single parameter - the text - and gives the string a rainbow colouring.
$format = new \Chrismou\Irc\TextFormatting\Format; $format->rainbow("This text will be FABULOUS"); // produces rainbow coloured text
Tests
To run the unit test suite:
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/phpunit
Or to test on all supported versions, ensure docker is installed and running, then run:
curl -s https://getcomposer.org/installer | php
php composer.phar install
./vendor/bin/dunit
License
Released under the BSD License. See LICENSE.
chrismou/php-irc-text-formatting 适用场景与选型建议
chrismou/php-irc-text-formatting 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 605 次下载、GitHub Stars 达 4, 最近一次更新时间为 2014 年 12 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「library」 「color」 「style」 「irc」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 chrismou/php-irc-text-formatting 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 chrismou/php-irc-text-formatting 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 chrismou/php-irc-text-formatting 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Symfony bundle for using the CssToInlineStyles translator by tijsverkoyen
Fixing php code style
The coding standard applying to all Youdot PHP projects, based on Doctrine set of PHPCS rules, with additional checks.
Native (browser) color input field for SilverStripe
Run all code formatting tools with one command: pretty
Jobilla's general code styling rules for different tools
统计信息
- 总下载量: 605
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2014-12-17