GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - JBlond/php-cli: php command line / cli scritping and coloring classes

BranchesTags
Open more actions menu

Latest commit

 

History

48 Commits
48 Commits

Folders and files

NameName
Last commit message
Last commit date
.phan
.phan
 
 
example
example
 
 
example2
example2
 
 
example3
example3
 
 
src/jblond/cli
src/jblond/cli
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 

Repository files navigation

php-cli

composer require jblond/php-cli

php command line / cli scripting classes

Example

<?php
use jblond\cli\Cli;
use jblond\cli\CliColors;

$cli = new Cli();
$colors = new CliColors();

$string = $colors->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;

Parameter example

<?php
$cli = new Cli();
$cli->addOption('v')->addOption('output', 'file.txt')->addOption('threads', 8);
$command = 'my-program ' . $cli->buildArguments();
echo $command;
exec($command, $output, $returnCode);

Inspired by the php.net docs http://php.net/manual/en/features.commandline.io-streams.php

and 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/

About

php command line / cli scritping and coloring classes

Topics

bashbash-scriptingclicli-scritpingphpphp-cliphp-command

Resources

Readme
MIT license
Activity

Stars

3 stars

Watchers

2 watching

Forks

1 fork
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.