1. Go to this page and download the library: Download gitory/pimple-cli 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/ */
gitory / pimple-cli example snippets
namespace Acme\DemoBundle\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class GreetCommand extends Command
{
protected function configure()
{
$this
->setName('demo:greet')
->setDescription('Greet someone')
->addArgument('name', InputArgument::REQUIRED, 'Who do you want to greet?')
;
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$name = $input->getArgument('name');
$text = 'Hello '.$name;
$output->writeln($text);
}
}
$silexApp = new Silex\Application();
$silexApp->register(new Gitory\PimpleCli\ServiceCommandServiceProvider());
// add your command as services ending in '.command' in your DI
$silexApp['user.new.command'] = function () {
return new Acme\DemoBundle\Command\GreetCommand();
};
$consoleApp = new Symfony\Component\Console\Application();
$consoleApp->addCommands($silexApp['command.resolver']->commands());
$consoleApp->run();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.