2017 © Pedro Peláez
 

library console

A bare minimum console with colors

image

irfantoor/console

A bare minimum console with colors

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 18 % Grown

The README.md

IrfanTOOR\Console

A bare minimum console with colors., (*1)

Usage

See different examples in the examples folder., (*2)

<?php

require dirname(__DIR__) . "/vendor/autoload.php";

use IrfanTOOR\Console;

$c = new Console;

# printing with style
$c->write("Hello ", "green");
$c->writeln("World ", "red");

# when a string of texts is given, a banner is printed
$c->writeln(['Its a banner'], ['bg_blue','white']);

# reading from console
$response = $c->read("Are you ok? [Y/N]", "info");

$c->write("you responded with: ");
$c->writeln($response, ["info", "reverse"]);

Styles

Foreground Styles

  • none
  • bold
  • dark
  • italic
  • underline
  • blink
  • reverse
  • concealed
  • default
  • black
  • red
  • green
  • yellow
  • blue
  • magenta
  • cyan
  • light_gray
  • dark_gray
  • light_red
  • light_green
  • light_yellow
  • light_blue
  • light_magenta
  • light_cyan
  • white

Background Styles

  • bg_default
  • bg_black
  • bg_red
  • bg_green
  • bg_yellow
  • bg_blue
  • bg_magenta
  • bg_cyan
  • bg_light_gray
  • bg_dark_gray
  • bg_light_red
  • bg_light_green
  • bg_light_yellow
  • bg_light_blue
  • bg_light_magenta
  • bg_light_cyan
  • bg_white

Theme Styles

  • info
  • error
  • warning
  • success
  • note
  • footnote
  • url

Note: All the theme styles can be modiied by providing the definition while creating the console. or by using the function setTheme., (*3)

<?php

$c = new IrfanTOOR\Console([
    'info' => ['bg_black', 'yellow'],
    'url'  => ['red', 'underline'],
]);

# Theme
$c->writeln("Modified theme >> info", "info");
$c->writeln("https://github.com/irfantoor/console", "url");

$c->setTheme([
    'url' => ['red', 'bg_yellow', 'underline']
]);

$c->writeln("https://github.com/irfantoor/console", "url");

The Versions

04/05 2018

dev-master

9999999-dev

A bare minimum console with colors

  Sources   Download

MIT

The Requires

 

The Development Requires

04/05 2018

v0.3.2

0.3.2.0

A bare minimum console with colors

  Sources   Download

MIT

The Requires

 

The Development Requires

02/05 2018

v0.3.1

0.3.1.0

A bare minimum console with colors

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2018

v0.3

0.3.0.0

A bare minimum console with colors

  Sources   Download

MIT

The Requires

 

The Development Requires

13/10 2017

v0.2

0.2.0.0

A bare minimum console with colors

  Sources   Download

MIT

The Requires

 

The Development Requires

15/05 2017

v0.1

0.1.0.0

A bare minimum console with colors

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires