1
0
Fork
You've already forked cli
0
cli tools/script runner
  • PHP 100%
Thomas Ernst 5baddaa4be
All checks were successful
ci / ci (push) Successful in 1m12s
Update changelog
2026年06月11日 18:57:44 +02:00
.forgejo/workflows Allow manual CI runs 2026年06月10日 20:58:18 +02:00
.github Add GitHub mirror README 2026年06月10日 21:14:39 +02:00
docs Format docs 2026年05月12日 14:06:11 +02:00
src The big rename 2026年05月10日 23:24:43 +02:00
tests The big rename 2026年05月10日 23:24:43 +02:00
.editorconfig Sync shared config files 2026年01月30日 21:44:55 +01:00
.gitattributes Update .gitattributes 2026年04月29日 09:49:56 +02:00
.gitignore Update coverage path 2026年04月29日 15:46:37 +02:00
CHANGELOG.md Update changelog 2026年06月11日 18:57:44 +02:00
composer.json Require dev package v4.2 2026年05月13日 13:12:05 +02:00
LICENSE.md Update license 2026年05月12日 14:25:48 +02:00
mago.toml Add mago config 2026年04月29日 16:59:16 +02:00
phpunit.xml.dist Update coverage tools 2026年05月12日 17:39:18 +02:00
psalm.xml.dist Rename phpunit and psalm config 2026年04月29日 15:43:10 +02:00
README.md Update README badges 2026年06月10日 21:22:55 +02:00
run Fix import paths 2026年05月10日 23:25:40 +02:00

Celemas Cli

ci code coverage type coverage psalm level Software License

A command line interface helper.

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 celemas/cli

Quick Start

Create a command by extending Celemas\Cli\Command:

use Celemas\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 Celemas\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.