jakub-the-developer / php-frame
在文本行周围绘制ascii框架。
v1.1
2021-07-16 08:37 UTC
Requires
- php: ^7.4||^8.0
Requires (Dev)
- phpunit/phpunit: ^9.5
README
关于
PHP库,用于在文本行周围绘制框架。
安装
需求
要安装此包,您必须使用 composer 2
。
安装
composer require jakub-the-developer/php-frame
使用方法
<?php require './vendor/autoload.php'; use JakubTheDeveloper\PhpFrame\Frame; $frame = new Frame( [ "First line of the text", "Second line of the text", "© Copyright information", ] ); echo $frame->draw();
示例
默认配置
$frame = new \JakubTheDeveloper\PhpFrame\Frame( [ "First line of the text", "Second line of the text", "© Copyright information", ] ); echo $frame->draw();
结果
╔═══════════════════════════════════════╗ ║ ║ ║ ║ ║ First line of the text ║ ║ Second line of the text ║ ║ © Copyright information ║ ║ ║ ║ ║ ╚═══════════════════════════════════════╝
屏幕截图
自定义配置
$configuration = new \JakubTheDeveloper\PhpFrame\FrameConfiguration( 1, // top margin lines 3, // bottom margin lines 26, // margin left 26, // margin right '+', // top-left corner symbol '+', // top-right corner symbol '+', // top-left corner symbol '+', // top-left corner symbol '~', // horizontal border symbol '|' // vertical border symbol ); $frame = new \JakubTheDeveloper\PhpFrame\Frame( [ "First, longer line of the text", "Second line", "And the third", ], $configuration );
结果
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ | | | First, longer line of the text | | Second line | | And the third | | | | | | | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
屏幕截图
运行测试
./vendor/bin/phpunit
带有代码覆盖率(html)
./vendor/bin/phpunit --coverage-html coverage