1. Go to this page and download the library: Download matks/vivian library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
matks / vivian example snippets
use Matks\Vivian\Tools as Output;
echo Output::bold('... done.') . PHP_EOL;
if ($success) {
echo Output::green('Success');
echo PHP_EOL;
} else {
echo Output::red('Failure !');
echo PHP_EOL;
echo Output::s_list1($errors);
}
use Matks\Vivian\Color;
use Matks\Vivian\Style;
use Matks\Vivian\Output;
$textElement = new Output\TextElement('Hello world !');
$boldStyle = new Style\Style(Style\StyleManager::BASH_BOLD);
$greenColor = new Color\TextColor(Color\TextColorManager::BASH_FOREGROUND_GREEN);
$cyanBackgroundColor = new Color\BackgroundColor(Color\BackgroundColorManager::BASH_BACKGROUND_CYAN);
$textElement->setTextColor($greenColor)
->setBackgroundColor($cyanBackgroundColor)
->addStyle($boldStyle)
;
echo $textElement->render();
use Matks\Vivian\Border;
use Matks\Vivian\Color;
use Matks\Vivian\Output;
$yellowColor = new Color\TextColor(Color\TextColorManager::BASH_FOREGROUND_YELLOW);
$border = new Border\Border(Border\Border::TYPE_FRAME);
$borderedElement = new Output\BorderedElement('Hello world !', $border);
$borderedElement->setTextColor($yellowColor);
echo $borderedElement->render();
use Matks\Vivian\Color;
use Matks\Vivian\Output;
use Matks\Vivian\Style;
use Matks\Vivian\Structure;
$greenColor = new Color\TextColor(Color\TextColorManager::BASH_FOREGROUND_GREEN);
$redColor = new Color\TextColor(Color\TextColorManager::BASH_FOREGROUND_RED);
$blinkingStyle = new Style\Style(Style\StyleManager::BASH_BLINK);
$textElement1 = new Output\TextElement('Hello');
$textElement2 = new Output\TextElement('world');
$textElement3 = new Output\TextElement('!');
$textElement1->setTextColor($greenColor);
$textElement2->setTextColor($redColor);
$textElement3->addStyle($blinkingStyle);
$elements = array(
$textElement1,
$textElement2,
$textElement3
);
$structure = new Structure\Structure(Structure\Structure::TYPE_LIST, '#', ' ');
$structuredElements = new Output\StructuredElements($elements, $structure);
echo $structuredElements->render();