@@ -19,6 +19,35 @@ Provide some useful utils for the php CLI.
1919composer require toolkit/cli-utils
2020```
2121
22+ ## Console color
23+
24+ ``` php
25+ Color::printf('<info >%s</info > world', 'hello');
26+ Color::println('hello world', 'info');
27+ Color::println('hello world', 'error');
28+ Color::println('hello world', 'warning');
29+ Color::println('hello world', 'success');
30+
31+ echo Color::render('hello world', 'success');
32+ ```
33+
34+ ![ colors] ( example/terminal-color.png )
35+
36+ ## PHP file highlight
37+
38+ > This is inspire jakub-onderka/php-console-highlighter
39+
40+ ``` php
41+ use Toolkit\Cli\Highlighter;
42+
43+ // this is an comment
44+ $rendered = Highlighter::create()->highlight(file_get_contents(__FILE__));
45+
46+ \Toolkit\Cli\Cli::write($rendered);
47+ ```
48+
49+ ![ colors] ( example/cli-php-file-highlight.png )
50+
2251## Parse CLI arguments and options
2352
2453``` php
@@ -117,35 +146,6 @@ Run demo: `php example/liteApp`
117146
118147![ cli-app] ( example/cli-app.png )
119148
120- ## PHP file highlight
121-
122- > This is inspire jakub-onderka/php-console-highlighter
123-
124- ``` php
125- use Toolkit\Cli\Highlighter;
126-
127- // this is an comment
128- $rendered = Highlighter::create()->highlight(file_get_contents(__FILE__));
129-
130- \Toolkit\Cli\Cli::write($rendered);
131- ```
132-
133- ![ colors] ( example/cli-php-file-highlight.png )
134-
135- ## Console color
136-
137- ``` php
138- Color::printf('<info >%s</info > world', 'hello');
139- Color::println('hello world', 'info');
140- Color::println('hello world', 'error');
141- Color::println('hello world', 'warning');
142- Color::println('hello world', 'success');
143-
144- echo Color::render('hello world', 'success');
145- ```
146-
147- ![ colors] ( example/terminal-color.png )
148-
149149## CLI downloader
150150
151151``` php
0 commit comments