1. Go to this page and download the library: Download antidot-fw/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/ */
antidot-fw / cli example snippets
#!/usr/bin/env php
// bin/console
declare(strict_types=1);
use Antidot\Cli\Application\Console;
set_time_limit(0);
call_user_func(static function (): void {
// config/container.php
use Aura\Di\ContainerBuilder;
use Antidot\Aura\Container\Config\ContainerConfig;
// Load configuration
$config = [ 'dependencies' => [], 'console' => [ 'commands' => [] ] ];
// Build container
$builder = new ContainerBuilder();
return $builder->newConfiguredInstance([
new ContainerConfig(\is_array($config) ? $config : []),
], $builder::AUTO_RESOLVE);
// bin/console
declare(strict_types=1);
use Antidot\Cli\Application\Console;
set_time_limit(0);
call_user_func(static function (): void {
// src/Console/SomeCommand
declare(strict_types=1);
namespace App\Console\Command;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use SomeDependency;
class SomeCommand extends Command
{
/**
* You can inject dependencies by constructor
* @var SomeDependency
*/
private $dependency;
public function __construct(SomeDependency $dependency) {
$this->dependency = $dependency;
parent::__construct();
}
protected function configure(): void
{
$this->setName('some:command:name');
}
protected function execute(InputInterface $input, OutputInterface $output): void
{
$output->writeLn('Hello World!!!');
}
}