Skip to content

Commit 72820bc

Browse files
committed
add more methods
1 parent efdc2e8 commit 72820bc

File tree

7 files changed

+165
-201
lines changed

7 files changed

+165
-201
lines changed

Diff for: .github/workflows/php.yml

+9-8
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,34 @@ name: Unit-tests
22

33
on: [push]
44

5-
# usage refer https://github.com/shivammathur/setup-php
65
jobs:
76
test:
87
name: Test on php ${{ matrix.php}} and ${{ matrix.os }}
98
runs-on: ${{ matrix.os }}
109
timeout-minutes: 10
1110
strategy:
12-
fail-fast: false # dont fast fail
11+
fail-fast: true
1312
matrix:
1413
php: [7.1, 7.2, 7.3, 7.4] #
1514
os: [ubuntu-latest, macOS-latest] # windows-latest,
1615

1716
steps:
18-
- uses: actions/checkout@v1
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
# usage refer https://github.com/shivammathur/setup-php
1921
- name: Setup PHP
2022
timeout-minutes: 5
21-
uses: shivammathur/setup-php@v1
23+
uses: shivammathur/setup-php@v2
2224
with:
2325
php-version: ${{ matrix.php}}
24-
extension-csv: mbstring #optional, setup extensions
25-
ini-values-csv: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
26+
tools: pecl, php-cs-fixer, phpunit
27+
extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis # , swoole-4.4.19 #optional, setup extensions
28+
ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration
2629
coverage: none #optional, setup coverage driver: xdebug, none
27-
pecl: true
2830

2931
- name: Display Env
3032
run: env
31-
# sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m
3233

3334
- name: Install dependencies
3435
run: composer install --no-progress --no-suggest

Diff for: README.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,35 @@ Provide some useful utils for the php CLI.
1919
composer 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

Diff for: composer.json

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"test": "vendor/bin/phpunit"
3737
},
3838
"suggest": {
39-
"inhere/php-validate": "Very lightweight data validate tool",
4039
"inhere/console": "a lightweight php console application library."
4140
}
4241
}

0 commit comments

Comments
 (0)