1. Go to this page and download the library: Download bear8421/command-line-tool 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/ */
bear8421 / command-line-tool example snippets
class TestCommand
{
public function __invoke($name, $upper, OutputInterface $output)
{
if ($name) {
$text = 'Hello, Iam ' . $name;
$output->writeln("Bear");
} else {
$text = 'Hello, Iam. BEAR';
}
if ($upper) {
$text = strtoupper($text);
}
$output->writeln($text);
}
}