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 |
'---'---------------'----------------------------------'