PHPackages                             grano22/simplecli - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. grano22/simplecli

ActiveLibrary[CLI &amp; Console](/categories/cli)

grano22/simplecli
=================

Create CLI apps easily with modular and user-friendly way

v1.0.0(2y ago)04MITPHP

Since Sep 16Pushed 2y ago1 watchersCompare

[ Source](https://github.com/Grano22/SimpleCli)[ Packagist](https://packagist.org/packages/grano22/simplecli)[ RSS](/packages/grano22-simplecli/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

SimpleCli
=========

[](#simplecli)

### Project details

[](#project-details)

- Version: v1.0.0

### Project Motto

[](#project-motto)

'Create CLI Apps with easy and modular way :)'

Description
-----------

[](#description)

This project is created to make much easier to create awesome CLI app with additional modules (addons) to handle various use cases for example: OutputWriter is standalone component, also TUI and more! :)

Features
--------

[](#features)

- Parse input args into top level command, subcommands, arguments and options,
- Multi levels commands (coming soon),
- Event-driven way - handle any kind of errors and other actions,
- Modular - App addons (coming soon),

Examples
--------

[](#examples)

**General example**:

```
use Grano22\SimpleCli\App\Factory\SimpleCliUniversalFilterConstraint;
use Grano22\SimpleCli\App\SimpleCliAppFactory;
use Grano22\SimpleCli\Command\Input\SimpleCliArgument;
use Grano22\SimpleCli\Command\Input\SimpleCliCommandInput;
use Grano22\SimpleCli\Command\Input\SimpleCliOption;

$myAwesomeCliApp = SimpleCliAppFactory::create()
    // Define help independent option for all commands
    ->withCommandsOption(
        commandNames: SimpleCliUniversalFilterConstraint::wildcard('*'),
        name: 'help',
        options: SimpleCliOption::OPTIONAL | SimpleCliOption::IGNORE_REST_REQUIRED | SimpleCliOption::NEGABLE
    )
    // Add your custom unknown error handler
    ->setUnexpectedErrorHandler(static function(Exception $exception) {
        // Do something with your custom exception

        echo $exception->getMessage();

        exit(1);
    })
    ->withCommandsArguments(
        commandNames: ['greetings'],
        name: 'tone',
        options: SimpleCliArgument::REQUIRED
    )
    ->withCommandOption(
        commandName: ['greetings', 'info'],
        name: 'verbose',
        options: SimpleCliOption::OPTIONAL
    )
    // Define your command logic :)
    ->withCommand(
        name: 'greetings',
        executionLogic: static function(SimpleCliCommandInput $input): int {
            $message = "Hello world";

            $tone = $input->getArguments()->getByName('tone')->getValue();

            if ($tone = 'high') {
                $message .= '!';
            }

            echo $message;

            return 0;
        }
    )
    ->build()
;

$myAwesomeCliApp->autoExecuteCommand();
```

---

**Adding event listeners**:

```
$myAwesomeCliApp = SimpleCliAppFactory::create()
    // Define your event listener for one or multiple events
    ->addEventsListener(static function(CommandNotFoundEvent|MissingArgumentEvent $event) {
        echo "Missing argument or command";

        exit(1);
    }, [CommandNotFoundEvent::class, MissingArgumentEvent::class])
;
```

---

**Adding options with aliases and default values**

```
$myAwesomeCliApp = SimpleCliAppFactory::create()
    ->withCommandOption(
        commandName: 'cmd1',
        name: 'optWithAliases',
        options: SimpleCliOption::REQUIRED,
        aliases: ['l', 'q']
    )
    ->withCommandOption(
        commandName: 'cmd1',
        name: 'optWithDefaultValue',
        options: SimpleCliOption::OPTIONAL,
        defaultValue: 'DEFAULT_VALUE'
    )
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

971d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/81a4347b27ecbcb920412e33dfa1c0999684b817bcc1a61dbe29473c0883ff19?d=identicon)[Grano22](/maintainers/Grano22)

---

Top Contributors

[![Grano22](https://avatars.githubusercontent.com/u/25087325?v=4)](https://github.com/Grano22 "Grano22 (10 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/grano22-simplecli/health.svg)

```
[![Health](https://phpackages.com/badges/grano22-simplecli/health.svg)](https://phpackages.com/packages/grano22-simplecli)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
