PHPackages                             bgaze/silex-console-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. bgaze/silex-console-provider

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

bgaze/silex-console-provider
============================

CLI application service provider for Silex

048PHP

Since Aug 27Pushed 8y ago1 watchersCompare

[ Source](https://github.com/bgaze/silex-console-provider)[ Packagist](https://packagist.org/packages/bgaze/silex-console-provider)[ RSS](/packages/bgaze-silex-console-provider/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

bgaze/silex-console-provider
============================

[](#bgazesilex-console-provider)

Provides for Silex :

- a handy way to create custom console commands.
- clear cache command : `$ php bin/console cache:clear`.

Please check [Console component documentation](http://symfony.com/doc/current/components/console/introduction.html) for more details about how to use console and build commands.

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

[](#installation)

Import the provider with Composer:

```
$ composer require bgaze/silex-console-provider dev-master

```

Clear cache commands requires cache path to be defined under `cache_dir` key :

```
$app['cache_dir'] = __DIR__ . '/../var/cache';
```

Then register it in your app :

```
use Bgaze\Silex\Provider\ConsoleServiceProvider;
$app->register(new ConsoleServiceProvider(), ['console.name' => 'My Application', 'console.version' => 'n/a']);
$app['console']->add(new \Bgaze\Silex\Console\Command\ClearCacheCommand());
```

Usage
-----

[](#usage)

Assuming your console executable is `bin/console`, call any of command like this :

```
$ php bin/console your:command

```

Clear your application cache like this :

```
$ php bin/console cache:clear

```

Write commands
--------------

[](#write-commands)

Your commands should extend `Bgaze\Silex\Console\Command\AbstractCommand`.
This base class provide acces to the current Silex application under `$app` protected attribute.

Here is a custom command example :

```
