77
88Provide some useful utils for the php CLI application.
99
10- - Parse CLI arguments and options
11- - Console color render
10+ - Simple CLI arguments and options parser.
11+ - Terminal console color render
1212- CLI code highlighter
1313- Build simple CLI application
1414- CLI ENV information helper
@@ -33,6 +33,49 @@ echo Color::render('hello world', 'success');
3333
3434![ colors] ( example/terminal-color.png )
3535
36+ ## Terminal control
37+
38+ examples:
39+
40+ ``` php
41+ use \Toolkit\Cli\Util\Terminal;
42+
43+ Terminal::forward(3);
44+ Terminal::backward(2);
45+
46+ Terminal::clearLine();
47+
48+ Terminal::clearScreen();
49+ ```
50+
51+ ### Control Methods
52+
53+ ``` php
54+ /**
55+ * @method static showCursor()
56+ * @method static hideCursor()
57+ * @method static savePosition()
58+ * @method static restorePosition()
59+ * @method static toTop()
60+ * @method static toColumn(int $step)
61+ * @method static up(int $step = 1)
62+ * @method static down(int $step = 1)
63+ * @method static forward(int $step = 1)
64+ * @method static backward(int $step = 1) Moves the terminal cursor backward
65+ * @method static toPrevNLineStart(int $step = 1)
66+ * @method static toNextNLineStart(int $step = 1)
67+ * @method static coordinate(int $col, int $row = 0)
68+ * @method static clearScreen()
69+ * @method static clearLine()
70+ * @method static clearToScreenBegin()
71+ * @method static clearToScreenEnd()
72+ * @method static scrollUp(int $step = 1)
73+ * @method static scrollDown(int $step = 1)
74+ * @method static showSecondaryScreen()
75+ * @method static showPrimaryScreen()
76+ */
77+ ```
78+
3679## PHP file highlight
3780
3881> This is inspire ` jakub-onderka/php-console-highlighter `
@@ -173,6 +216,10 @@ $down->start();
173216
174217- https://github.com/inhere/php-console Build rich console application
175218
219+ ## Refer
220+
221+ - https://www.sitepoint.com/howd-they-do-it-phpsnake-detecting-keypresses/
222+
176223## License
177224
178225[ MIT] ( LICENSE )
0 commit comments