1. Go to this page and download the library: Download celema/console 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/ */
celema / console example snippets
use Celema\Console\{Arg, Command, Opt, Io};
#[Command('grp:mycommand', 'This is my command')]
class MyCommand
{
public function __invoke(
Io $io,
#[Arg('Who to greet')]
string $name = 'world',
#[Opt('Rows per batch', short: '-b')]
int $batch = 500,
#[Opt('Skip the safety net')]
bool $force = false,
): int {
$io->line('Running my command for %s in batches of %d', $name, $batch);
$io->success('Command completed!');
return 0;
}
}
Celema\Console\Runner;
$runner = new Runner();
$runner->add(new MyCommand());
exit($runner->run());
$runner = new Runner(
[MyCommand::class],
resolve: $container->get(...),
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.