PHPackages                             knplabs/console-service-provider - 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. knplabs/console-service-provider

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

knplabs/console-service-provider
================================

console service provider for Silex

v2.2.0(8y ago)1081.4M—9.9%35[2 issues](https://github.com/KnpLabs/ConsoleServiceProvider/issues)20MITPHPPHP &gt;=5.5.9

Since Jun 13Pushed 3y ago30 watchersCompare

[ Source](https://github.com/KnpLabs/ConsoleServiceProvider)[ Packagist](https://packagist.org/packages/knplabs/console-service-provider)[ Docs](http://knplabs.com)[ RSS](/packages/knplabs-console-service-provider/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (8)Versions (7)Used By (20)

DEPRECATED
==========

[](#deprecated)

Unfortunately we decided to not maintain this project anymore ([see why](https://knplabs.com/en/blog/news-for-our-foss-projects-maintenance)). If you want to mark another package as a replacement for this one please send an email to .

ConsoleServiceProvider
======================

[](#consoleserviceprovider)

Provides a [`Symfony\Component\Console`](http://symfony.com/doc/current/components/console.html) based console for Silex 2.x.

Installation
------------

[](#installation)

Add `knplabs/console-service-provider` to your `composer.json` and register the service provider:

```
composer require knplabs/console-service-provider

```

```
use Knp\Provider\ConsoleServiceProvider;

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

You can now copy the `console` executable from the `bin` folder to whatever place you see fit, and tweak it to your needs.

You will need a way to fetch your silex application, the most common way is to return it from your bootstrap file:

```
use Knp\Provider\ConsoleServiceProvider;
use Silex\Application;

$app = new Application();

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

return $app;
```

For the rest of this documentation, we will assume you do have a `bin`directory, so the `console` executable will be located at `bin/console`.

Usage
-----

[](#usage)

Use the console just like any `Symfony\Component\Console` based console:

```
$ bin/console my:command

```

or on Windows:

```
$ php bin/console my:command

```

Configuration parameters
------------------------

[](#configuration-parameters)

ParameterDefaultDescription`console.name` (string)Silex consoleName of your console application`console.version` (string)UNKNOWNVersion of your console application`console.project_directory` (string)(auto-detected)Your project's directory path. The default value should work, assuming the provider is installed in `vendor/knplabs/console-service-provider``console.class` (string)Knp\\Console\\ApplicationClass name of the console service`console.boot_in_constructor` (bool)falseWhether the console should boot Silex when loaded (set it to `true` if you depend on [a bug that was fixed in 2.1](CHANGELOG.md#booting-silex-from-the-console-constructor))`console.command.ids` (array)array()Console commands registered as servicesDefault commands
----------------

[](#default-commands)

The service provider will register the following commands if the corresponding Symfony components are installed:

- From `symfony/twig-bridge`, the `lint:twig` and `debug:twig` commands
- From `symfony/yaml`, the `lint:yaml` command

### Web-server-bundle support

[](#web-server-bundle-support)

The `WebServerServiceProvider` will register the commands provided by `symfony/web-server-bundle`.

```
$app = new Silex\Application();

$app->register(new Knp\Provider\ConsoleServiceProvider());
$app->register(new Knp\Provider\WebServerServiceProvider(), array(
    // Folder that contains your front controller/public files
    'web_server.document_root' => __DIR__.'/../public',
));
```

The server commands expect your front controller to be located in your document root and be called `app_dev.php`, `app.php`, `index_dev.php` or `index.php`.

For more information, please consult the [Symfony documentation](https://symfony.com/doc/current/setup/built_in_web_server.html).

Recipes
-------

[](#recipes)

- [Writing and registering commands](doc/adding-commands.md)
- [Testing your commands](doc/testing-commands.md)
- [Listening to console events](doc/console-events.md)

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity54

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 52.6% 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

Every ~424 days

Total

5

Last Release

3025d ago

Major Versions

1.1 → 2.02016-06-01

PHP version history (2 changes)v1.0PHP &gt;=5.3.2

v2.1.0PHP &gt;=5.5.9

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10758?v=4)[Geoffrey Bachelet](/maintainers/ubermuda)[@ubermuda](https://github.com/ubermuda)

![](https://www.gravatar.com/avatar/2a3ccc0e974301e255297ef412ee68e1e0868dba12620b2e6adf1ec4e58bcfe7?d=identicon)[crimsonlabs](/maintainers/crimsonlabs)

---

Top Contributors

[![skalpa](https://avatars.githubusercontent.com/u/4943191?v=4)](https://github.com/skalpa "skalpa (30 commits)")[![crimsonlabs](https://avatars.githubusercontent.com/u/97939377?v=4)](https://github.com/crimsonlabs "crimsonlabs (9 commits)")[![ubermuda](https://avatars.githubusercontent.com/u/10758?v=4)](https://github.com/ubermuda "ubermuda (7 commits)")[![weaverryan](https://avatars.githubusercontent.com/u/121003?v=4)](https://github.com/weaverryan "weaverryan (3 commits)")[![batwolf](https://avatars.githubusercontent.com/u/30409909?v=4)](https://github.com/batwolf "batwolf (2 commits)")[![TiGR](https://avatars.githubusercontent.com/u/281226?v=4)](https://github.com/TiGR "TiGR (2 commits)")[![PedroTroller](https://avatars.githubusercontent.com/u/1766827?v=4)](https://github.com/PedroTroller "PedroTroller (1 commits)")[![flip111](https://avatars.githubusercontent.com/u/2244480?v=4)](https://github.com/flip111 "flip111 (1 commits)")[![ovr](https://avatars.githubusercontent.com/u/572096?v=4)](https://github.com/ovr "ovr (1 commits)")[![rybakit](https://avatars.githubusercontent.com/u/533861?v=4)](https://github.com/rybakit "rybakit (1 commits)")

---

Tags

consolesilex

### Embed Badge

![Health badge](/badges/knplabs-console-service-provider/health.svg)

```
[![Health](https://phpackages.com/badges/knplabs-console-service-provider/health.svg)](https://phpackages.com/packages/knplabs-console-service-provider)
```

###  Alternatives

[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[matthiasnoback/symfony-console-form

Use Symfony forms for Console command input

368264.8k8](/packages/matthiasnoback-symfony-console-form)[cilex/console-service-provider

Console Service Provider

273.1M3](/packages/cilex-console-service-provider)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)

PHPackages © 2026

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