ali-eltaweel / cli-app
CLI application skeleton for PHP projects.
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/ali-eltaweel/cli-app
Requires
- php: ^8.1
- ali-eltaweel/command-parser: ^1.0.0
README
CLI application skeleton for PHP projects
Installation
Install cli-app via Composer:
composer require ali-eltaweel/cli-app
Usage
Defining Application
use App\CLI\CliApplication; use CommandParser\Specs\Command; class MyApp extends CliApplication { protected static function getCommandSpecs(): Command { return new Command('my-app'); } protected function setup(): void { // this code runs once at the start } protected function loop(): void { // this code runs repeatedly } }
Running Application
MyApp::main(...$argv);
Run as Daemon
class MyApp extends CliApplication { protected function setup(): void { $this->daemonize(); } }