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 yesterday

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 13% 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

1022d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25087325?v=4)[Grano22](/maintainers/Grano22)[@Grano22](https://github.com/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

[illuminate/console

The Illuminate Console package.

13046.0M6.5k](/packages/illuminate-console)[styleci/cli

The CLI tool for StyleCI

71470.5k9](/packages/styleci-cli)[winbox/args

Windows command-line formatter

20720.9k21](/packages/winbox-args)[tomatophp/filament-artisan

Simple but yet powerful library for running some artisan commands for FilamentPHP

3275.4k1](/packages/tomatophp-filament-artisan)[thettler/laravel-console-toolkit

This Package provides some usefully console features like the attribute syntax for arguments and options, validation, auto ask and casting.

324.1k](/packages/thettler-laravel-console-toolkit)

PHPackages © 2026

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