php display table
1.0.0
+=========+========+=======+=========+
| Console | Tables | Made | Easy |
+=========+========+=======+=========+
一个简单的 PHP 库,用于生成文本格式的表,对于在日志或控制台中编写摘要很有用。
最简单的安装方法是通过 Composer:
$ composer require mmarica/display-table
支持以下 PHP 版本:
打印文本表就像这样简单:
<?php
require_once dirname ( __FILE__ ) . ' /vendor/autoload.php ' ;
use Mmarica DisplayTable ;
print DisplayTable:: create ()
-> headerRow ([ ' # ' , ' Person ' , ' Hobbies ' ])
-> dataRows ([
[ ' 1 ' , ' Mihai ' , ' Cycling, Gaming, Programming ' ],
[ ' 2 ' , ' Chewbacca ' , ' Growling, hibernating ' ],
[ ' 3 ' , ' Philip J. Fry ' , ' Time traveling, eating anchovies ' ],
])
-> toText ()-> generate ();
.---.---------------.----------------------------------.
| # | Person | Hobbies |
:---+---------------+----------------------------------:
| 1 | Mihai | Cycling, Gaming, Programming |
| 2 | Chewbacca | Growling, hibernating |
| 3 | Philip J. Fry | Time traveling, eating anchovies |
'---'---------------'----------------------------------'