pgooch/php-ascii-tables
Composer 安装命令:
composer require pgooch/php-ascii-tables
包简介
Convert multi-dimensional arrays into ASCII Tabled, and vise-versa.
README 文档
README
This class will convert multi-dimensional arrays into ASCII Tables, and vice-versa.
Setup & Use
Include ascii_table.php and call a new instance of the object. You can then call one of three functions:
make_Table($array, [$title], [$return], [$autoalign_cells])will make a table with the multi-dimensional$arraypassed. Additionally you can specify an optional$titlethat will be centered on a line above the table. The$returnvariable gives you 3 options;Truewill return the table as an array,Falsewill output the array directly, and aStringwill attempt to save the array in a text file with the given name/location and will return true/false upon completlion. If false the error message will be logged to the$errorclass variable. The parameter$autoalign_cells, if set toTrue, all columns containing only numeric datatypes will be aligned to the right of the cell.break_Table($table)Takes an table or a filename that containing a text file output frommake_table()and will return a multi-dimensional array similar to the one that you would have given itmake_table()to create it.scrape_Table($table, $key, [$value])will take a table or link to a file containing a table asbreak_table()does but will only return they key/value pairs you request. If you do not include the value it will use the key as the value and return it in a numeric array. It should be noted that if you use both key and value that muliple keys will overrite eachother and the returning array will only contain the last one in the table.
Examples
Examples of the classes functionality can be found in examples.php, and a text output can be found in example.txt. Table will be output or returned like this:
Colors in Various Formats
+--------+---------+-----+-------+------+-----+------------+-----------+------+---------+--------+-----+
| color | HEX | Red | Green | Blue | Hue | Saturation | Lightness | Cyan | Magenta | Yellow | Key |
+--------+---------+-----+-------+------+-----+------------+-----------+------+---------+--------+-----+
| Red | #FF0000 | 255 | 0 | 0 | 0 | 100 | 50 | 0 | 100 | 100 | 0 |
| Orange | #FFA500 | 255 | 165 | 0 | 39 | 100 | 50 | 0 | 100 | 35 | 0 |
| Yellow | #FFFF00 | 255 | 255 | 0 | 60 | 100 | 50 | 0 | 0 | 100 | 0 |
| Green | #008000 | 0 | 128 | 0 | 120 | 100 | 25 | 100 | 0 | 100 | 50 |
| Blue | #0000FF | 0 | 0 | 255 | 240 | 100 | 50 | 100 | 100 | 0 | 0 |
| Indigo | #4B0082 | 75 | 0 | 130 | 275 | 100 | 25 | 42 | 100 | 0 | 49 |
| Violet | #EE82EE | 238 | 130 | 238 | 300 | 76 | 72 | 0 | 45 | 0 | 7 |
+--------+---------+-----+-------+------+-----+------------+-----------+------+---------+--------+-----+
pgooch/php-ascii-tables 适用场景与选型建议
pgooch/php-ascii-tables 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.31k 次下载、GitHub Stars 达 36, 最近一次更新时间为 2016 年 09 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「cli」 「ascii」 「tables」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pgooch/php-ascii-tables 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pgooch/php-ascii-tables 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pgooch/php-ascii-tables 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
(ru) language pack for the Static Info Tables providing localized names for countries, currencies and so on.
Sets of digits or characters that may be used for base conversions, encoding and decoding tasks, and input validation
Makes the ASCII Bell sound or flashes terminal
(Ukrainian) language pack for the Static Info Tables providing localized names for countries,currencies and so on.
Slug Generator
PHP Cli Image - This library converts a given image to ASCII string.
统计信息
- 总下载量: 4.31k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 36
- 点击次数: 24
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPLv3
- 更新时间: 2016-09-24