PHP code example of dbemfica / phpcli
1. Go to this page and download the library: Download dbemfica/phpcli 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/ */
dbemfica / phpcli example snippets
and = new \PHPCLI\FirstCommand();
$app = new \PHPCLI\App($argv);
$app->addCommand($command);
$app->run();
use PHPCLI\Command;
class FirstCommand extends Command
{
public $name = "First";
public $description = "Command Example";
public $arguments = [
'name'
];
public function execute()
{
echo "First command";
}
}
use PHPCLI\Command;
class FirstCommand extends Command
{
public $name = "First";
public $description = "Command Example";
public $arguments = [
'name'
];
public function execute()
{
$name = $this->getArgument('name');
echo "Hello ".$name.PHP_EOL;
}
}