PHP code example of aeforge / terminal
1. Go to this page and download the library: Download aeforge/terminal library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
aeforge / terminal example snippets
//Message class is used to create an already defined styled text and blocks
use Aeforge\Terminal\Message;
//Terminal is the main class
use Aeforge\Terminal\Terminal;
// Creates a new item and added to the list.
// use {} to create a parameter.
Terminal::Item("myitem {unknown_parameter}", function($unknown_parameter)
{
echo "The unknown_parameter is : " . $unknown_parameter;
});
Terminal::Item("myitem {unknown_parameter} {another_parameter}", function($unknown_parameter, $another_parameter)
{
(new Message)::message($unknown_parameter) . (new Message)::message($another_parameter);
});
// Calling a function
function myFunction($what_the_user_said) { echo $what_the_user_said; }
Terminal::Item("whattext {what_the_user_said}", "myFunction");
//Always call boot at the end to start parsing the terminal items list
Terminal::boot();