colibri-fw/console

Colibri Console component

dev-master 2024-05-21 16:26 UTC

This package is auto-updated.

Last update: 2024-12-21 17:43:28 UTC


README

Usage example:

file: ./app:

#!/usr/bin/env php
<?php
require __DIR__ . '/vendor/autoload.php';

use Application\Command\Cache;
use Colibri\Console\Application;

exit(
    (new Application('Colibri Tools', 'dev'))
    ->setLogo('_________        .__  ._____.         .__
\_   ___ \  ____ |  | |__\_ |_________|__|
/    \  \/ /  _ \|  | |  || __ \_  __ \  |
\     \___(  <_> )  |_|  || \_\ \  | \/  |
 \______  /\____/|____/__||___  /__|  |__|
        \/                    \/          ')
    ->addCommands([
        new Cache\Clear(),
    ])
    ->run()
);

in terminal:

chmod +x ./app

file: Application/Command/Cache/Clear.php:

<?php
namespace Application\Command\Cache;

use Colibri\Cache\Cache;
use Colibri\Console\Command;

class Clear extends Command
{

    protected function definition(): Command
    {
        return $this
            // !!! You does not need to set the name of command. It will be 'cache:clear' automatically.
            ->setDescription('Clears all cache');
    }

    protected function go(): int
    {
        Cache::flush();

        return 0;
    }
}