Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jblond/php-cli
php command line / cli scritping and coloring classes
https://github.com/jblond/php-cli
bash bash-scripting cli cli-scritping php php-cli php-command
Last synced: 2 months ago
JSON representation
php command line / cli scritping and coloring classes
- Host: GitHub
- URL: https://github.com/jblond/php-cli
- Owner: JBlond
- License: mit
- Created: 2016-09-05T18:33:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-22T10:00:58.000Z (almost 2 years ago)
- Last Synced: 2024-09-19T11:06:18.804Z (3 months ago)
- Topics: bash, bash-scripting, cli, cli-scritping, php, php-cli, php-command
- Language: PHP
- Homepage:
- Size: 25.4 KB
- Stars: 3
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# php-cli
[![Code Climate](https://codeclimate.com/github/JBlond/php-cli/badges/gpa.svg)](https://codeclimate.com/github/JBlond/php-cli)
##
```bash
composer require jblond/php-cli
```## php command line / cli scripting classes
### Example
```PHP
getColoredString('This is a test','red','black');
$cli->output($string); // normal
$cli->error($string); // error// This input requires Hello or world as input
$cli->input('Hello world: ',array('Hello','world'));// This input requires only test
$cli->input('Test2: ', 'test');
// This input requires any input
$cli->input('Free input: ', '');
// Question with default N
$answer = $cli->input('Do this? y/N', array('y','n','Y','N'), 'N');
echo $answer;
```Inspired by the php.net docs
http://php.net/manual/en/features.commandline.io-streams.phpand a modified version of
http://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/