colibri-fw / console
Colibri Console component
dev-master
2024-05-21 16:26 UTC
Requires
- php: ^7.1|^8.0
- colibri-fw/util: dev-master@dev
- symfony/console: ^3.4.17 || ^4.1.6 || ^5.0
This package is auto-updated.
Last update: 2024-11-21 17:30:16 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; } }