-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.php
More file actions
38 lines (26 loc) · 1.01 KB
/
examples.php
File metadata and controls
38 lines (26 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use Weew\ConsoleFormatter\OutputBackground;
use Weew\ConsoleFormatter\OutputColor;
use Weew\ConsoleFormatter\OutputFormat;
use Weew\ConsoleFormatter\ConsoleFormatter;
require 'vendor/autoload.php';
$formatter = new ConsoleFormatter();
$formatter->style('error')
->setColor(OutputColor::WHITE)
->setBackground(OutputBackground::RED);
$formatter->style('warning')
->setColor(OutputColor::WHITE)
->setBackground(OutputBackground::YELLOW);
$formatter->style('important')
->setColor(OutputColor::WHITE)
->setBackground(OutputBackground::CYAN)
->setFormat([OutputFormat::BOLD, OutputFormat::UNDERLINE]);
echo $formatter->format(<<<STRING
<style fg=red bg=blue>red text with blue background</style>
<error fmt=bold>bold error text</error>
<warning>warning text</warning>
<important>important text</important>
<style bg=white fg=red>here is an <unknown>unknown</unknown> style tag</style>
sample <error>error with an <important>important <warning>warning</warning></important></error> text
STRING
);