A lightweight php library for your php cli needs.
Features :
- ⌨️ Get user input!
- 🎨 Have colorful text!
Pauses the php script and asks user for an input!
- Use get_input() function to ask for users input
$input = get_input();
echo $input;
Here are some examples of how to use the get_input
function:
echo "What is your name?";
$name = get_input();
echo "Welcome $name!";
Helps you generate text styles that you can use later!
- Instantiate an object of the
textColor
class:
//Get the user's name
echo "What is your name?";
$name = get_input();
- Set the text color, background color, and text effect using the
__construct()
method:
$textColor = new textColor('text color', 'background color', 'text type');
All Text Colors
black, red, green, yellow, blue, magenta, cyan, light gray, dark gray, light red, light green, light yellow, light blue, light magenta light cyan white
All Background Colors
black, red, green, yellow, blue, magenta, cyan, light gray, dark gray, light red, light green, light yellow, light blue, light magenta light cyan white
All Text Types
bold, dim, underlined, blink, reverse, hidden
$string = $textColor->getColoredString('Hello, world!');
echo $string;
Here are some examples of how to use the textColor
class:
// Print "Hello, world!" in red text on a yellow background with bold text effect
$red = new textColor('red', 'yellow', 'bold');
$string = $red->getColoredString('Hello, world!');
echo $string;
// Print "Success" in green text
$success = new textColor('green');
$string = $success->getColoredString('Success');
echo $string;
// Print "Warning" in yellow text
$warning = new textColor('yellow');
$string = $warning->getColoredString('Warning');
echo $string;
// Print "Error" in red text
$error = new textColor('red');
$string = $error->getColoredString('Error');
echo $string;
- lera2od