Skip to content

Commit 9587412

Browse files
committed
feat: remove helper.php
Signed-off-by: Jack Cherng <jfcherng@gmail.com>
1 parent 088ade8 commit 9587412

File tree

3 files changed

+8
-46
lines changed

3 files changed

+8
-46
lines changed

composer.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
"autoload": {
2121
"psr-4": {
2222
"Jfcherng\\Utility\\": "src/"
23-
},
24-
"files": [
25-
"src/helpers.php"
26-
]
23+
}
2724
},
2825
"autoload-dev": {
2926
"psr-4": {

demo.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22

33
include __DIR__ . '/vendor/autoload.php';
44

5+
use Jfcherng\Utility\CliColor;
6+
57
// colors in a string using a comma as the delimiter
6-
echo str_cli_color('foo', 'f_light_cyan, b_yellow'); // "\033[1;36;43mfoo\033[0m"
8+
echo CliColor::color('foo', 'f_light_cyan, b_yellow'); // "\033[1;36;43mfoo\033[0m"
79

810
echo \PHP_EOL;
911

1012
// colors in an array
11-
echo str_cli_color('foo', ['f_white', 'b_magenta']); // "\033[1;37;45mfoo\033[0m"
13+
echo CliColor::color('foo', ['f_white', 'b_magenta']); // "\033[1;37;45mfoo\033[0m"
1214

1315
echo \PHP_EOL;
1416

1517
// do not auto reset color at the end of string
16-
echo str_cli_color('foo', ['f_red', 'b_green', 'b', 'blk'], false); // "\033[31;42;1;5mfoo"
18+
echo CliColor::color('foo', ['f_red', 'b_green', 'b', 'blk'], false); // "\033[31;42;1;5mfoo"
1719

1820
// manually add color reset
19-
echo str_cli_color('', 'reset'); // "\033[0m"
21+
echo CliColor::color('', 'reset'); // "\033[0m"
2022

2123
echo \PHP_EOL;
2224

2325
// remove all color codes from a string
24-
echo str_cli_nocolor("\033[31;42;5mfoo\033[0mbar"); // "foobar"
26+
echo CliColor::noColor("\033[31;42;5mfoo\033[0mbar"); // "foobar"
2527

2628
echo \PHP_EOL;

src/helpers.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

0 commit comments

Comments
 (0)