1. Go to this page and download the library: Download tivie/command 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/ */
$cmd = new \Tivie\Command\Command(\Tivie\Command\ESCAPE);
$cmd->setCommand('ping')
->addArgument(
new Argument('-n', 3, \Tivie\OS\WINDOWS_FAMILY)
)
->addArgument(
new Argument('-l', 32, \Tivie\OS\WINDOWS_FAMILY)
)
->addArgument(
new Argument('-c', 3, \Tivie\OS\UNIX_FAMILY)
)
->addArgument(
new Argument('-s', 24, \Tivie\OS\UNIX_FAMILY)
)
->addArgument(
new Argument('www.google.com')
);
$result = $cmd->run();
echo $result->getStdOut(); // The Standard Output of the command
echo $result->getLastLine(); // The last line of the Standard Output
echo $result->getStdIn(); // The passed standard input
echo $result->getStdErr(); // The standard error
echo $result->getExitCode(); // The command's exit code
$cmd1 = new \Tivie\Command\Command();
$cmd1->setCommand('php')
->addArgument(new Argument('-v'));
$cmd2 = new \Tivie\Command\Command();
$cmd2->setCommand('echo')
->addArgument(new Argument('foo'));
$results = $cmd1->chain()
->add($cmd2)
/* any number of commands here */
->run();