PHP library for drawing a frame around lines of text.
To install this package you have to use 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();
Result:
╔═══════════════════════════════════════╗
║ ║
║ ║
║ First line of the text ║
║ Second line of the text ║
║ © Copyright information ║
║ ║
║ ║
╚═══════════════════════════════════════╝
Screenshot:
$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
);
Result:
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
| |
| First, longer line of the text |
| Second line |
| And the third |
| |
| |
| |
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+
Screenshot:
./vendor/bin/phpunit
with code coverage (html):
./vendor/bin/phpunit --coverage-html coverage