duon/cli

Duon cli tools/runner

Installs: 83

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/duon/cli

0.1.1 2026-01-29 22:21 UTC

This package is auto-updated.

Last update: 2026-01-31 19:08:13 UTC


README

Software License Codacy Badge Codacy Badge Psalm coverage Psalm level

A command line interface helper like Laravel's Artisan with way less magic.

Features

  • Simple command creation with automatic help generation
  • Built-in color support for terminal output
  • Command-specific help with php run help <command>
  • Built-in commands command for shell autocomplete
  • Support for --key=value and --key value option syntax
  • Output helpers: info(), success(), warn(), error(), echoln()
  • Text indentation and wrapping with indent()
  • Debug mode for detailed error traces
  • 100% test coverage

Installation

composer require duon/cli

Quick Start

Create a command by extending Duon\Cli\Command:

use Duon\Cli\Command;

class MyCommand extends Command {
    protected string $name = 'mycommand';
    protected string $group = 'MyGroup';
    protected string $description = 'This is my command';

    public function run(): int
    {
        $this->info("Running my command");
        $this->success("Command completed!");
        return 0;
    }
}

Create a runner script:

<?php
require __DIR__ . '/vendor/autoload.php';

use Duon\Cli\{Runner, Commands};

$commands = new Commands([new MyCommand()]);
$runner = new Runner($commands);
$runner->run();

Run your command:

$ php run mycommand
Running my command
Command completed!

License

This project is licensed under the MIT license.