malios/php-to-ascii-table
Composer 安装命令:
composer require malios/php-to-ascii-table
包简介
A PHP library to generate plain text tables.
README 文档
README
A small PHP library for generating plain text tables.
Getting Started
Prerequisites
- PHP >= 7
- ext-mbstring
- Optionally Install php-ds extension (Recommended).
Installation
Install via composer:
$ composer require malios/php-to-ascii-table
Usage
<?php $builder = new \AsciiTable\Builder(); $builder->addRows([ [ 'Order No' => 'A0001', 'Product Name' => 'Intel CPU', 'Price' => 700.00, 'Quantity' => 1 ], [ 'Order No' => 'A0002', 'Product Name' => 'Hard disk 10TB', 'Price' => 500.00, 'Quantity' => 2 ], [ 'Order No' => 'A0003', 'Product Name' => 'Dell Laptop', 'Price' => 11600.00, 'Quantity' => 8 ], [ 'Order No' => 'A0004', 'Product Name' => 'Intel CPU', 'Price' => 5200.00, 'Quantity' => 3 ] ]); $builder->addRow([ 'Order No' => 'A0005', 'Product Name' => 'A4Tech Mouse', 'Price' => 100.00, 'Quantity' => 10 ]); $builder->setTitle('Product List'); echo $builder->renderTable(); // Show only some fields $builder->showColumns(['Order No', 'Product Name', 'Quantity']); echo $builder->renderTable();
Build table from objects
You can build table form any object that implements JsonSerializable interface.
<?php class Person implements \JsonSerializable { private $name; private $age; public function __construct(string $name, int $age) { $this->name = $name; $this->age = $age; } public function jsonSerialize() { return [ 'name' => $this->name, 'age' => $this->age ]; } } $builder = new \AsciiTable\Builder(); $builder->addRow(new Person('John', 25)); $builder->addRow(new Person('Bill', 30)); echo $builder->renderTable();
Contributing
All contributors are welcome. You can open a new issue or submit a pull request. See CONTRIBUTING.md for details.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.
malios/php-to-ascii-table 适用场景与选型建议
malios/php-to-ascii-table 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 141.64k 次下载、GitHub Stars 达 28, 最近一次更新时间为 2017 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「ascii」 「table」 「plain text table」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 malios/php-to-ascii-table 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 malios/php-to-ascii-table 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 malios/php-to-ascii-table 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Sets of digits or characters that may be used for base conversions, encoding and decoding tasks, and input validation
Plug-ins for DataTables
A component that allows creating responsive HTML tables or lists from data object
Makes the ASCII Bell sound or flashes terminal
Adjacency List’ed Closure Table database design pattern implementation for Laravel. Includes restore of tree
Slug Generator
统计信息
- 总下载量: 141.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 29
- 点击次数: 30
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-25
