PHPackages                             rmlasseter/silex-cli - 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. rmlasseter/silex-cli

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

rmlasseter/silex-cli
====================

A console provider for the Silex micro-framework

26PHP

Since Jan 31Pushed 12y ago1 watchersCompare

[ Source](https://github.com/rmlasseter/silex-cli)[ Packagist](https://packagist.org/packages/rmlasseter/silex-cli)[ RSS](/packages/rmlasseter-silex-cli/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

SilexCLI
========

[](#silexcli)

Services
--------

[](#services)

### console

[](#console)

An instance of SilexCLI\\Console (which extends Symfony\\Component\\Console\\Application).

### console.input

[](#consoleinput)

An instance of Symfony\\Component\\Console\\Input\\ArgvInput, accessible to command callbacks.

### console.output

[](#consoleoutput)

An instance of Symfony\\Component\\Console\\Output\\ConsoleOutput, accessible to command callbacks.

### console.status

[](#consolestatus)

Contains the exit code of the last console execution.

Registering
-----------

[](#registering)

```
	use SilexCLI\Provider\ConsoleServiceProvider;

	$app->register(new ConsoleServiceProvider());
```

Usage
-----

[](#usage)

Commands can be registered with the console's route method. The route pattern is used to identify arguments, and dependency injection is used to identify argument defaults and options.

If a callback parameter is present in the route pattern, it is defined as an argument. Parameters not present in the route pattern are

### Command Arguments

[](#command-arguments)

If a callback parameter is present in the route pattern, it is defined as an argument. If it has a default value, then it will not be required by the console.

```
	$app['console']->match('example {arg1}', function($arg1) use ($app) {
		...
	});
```

### Command Options

[](#command-options)

Callback parameters not present in the route pattern will be added to the command definition as options. All options must have a default value.

```
	$app['console']->match('example', function($opt1 = 'default') use ($app) {
		...
	});
```

If the option default is a boolean value, it will be treated as a flag.

```
	$app['console']->match('example', function($flag1 = false) use ($app) {
		...
	});
```

### Array Inputs

[](#array-inputs)

Arguments and options can accept array values as well (though only the last argument may be an array).

```
	$app['console']->match('example {array-arg}', function(array $array_arg, array $array_opt = array()) use ($app) {
		...
	});
```

Traits
------

[](#traits)

SilexCLI\\Application\\ConsoleTrait adds the following shortcuts:

### command

[](#command)

Adds a new command to the console and returns it.

```
	$app->command($pattern, $callback);
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6afa35c7ee868c10438ac47b105b196672720673127a848b1bc4d836bda6bb9?d=identicon)[rmlasseter](/maintainers/rmlasseter)

---

Top Contributors

[![rmlasseter](https://avatars.githubusercontent.com/u/5660821?v=4)](https://github.com/rmlasseter "rmlasseter (5 commits)")

### Embed Badge

![Health badge](/badges/rmlasseter-silex-cli/health.svg)

```
[![Health](https://phpackages.com/badges/rmlasseter-silex-cli/health.svg)](https://phpackages.com/packages/rmlasseter-silex-cli)
```

###  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)
