2017 © Pedro Peláez
 

library console-service-provider

Provides Symfony/Console to Silex application

image

kzykhys/console-service-provider

Provides Symfony/Console to Silex application

  • Wednesday, May 29, 2013
  • by kzykhys
  • Repository
  • 1 Watchers
  • 3 Stars
  • 10 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

ConsoleServiceProvider

Parameters

  • console.options (optional): Array of Options, (*1)

    These options are available:, (*2)

    • name: The name of application (Symfony\Component\Console\Application::setName())
    • version: The version of application (Symfony\Component\Console\Application::setVersion())
  • console.commands (optional): Array of command (instance of Symfony/Console/Command), (*3)

Services

  • console: instance of Symfony\Component\Console\Application

Usage

app/bootstrap.php, (*4)

``` php <?php, (*5)

use KzykHys\Silex\Provider\Console\ConsoleServiceProvider;, (*6)

$app = new \Silex\Appliation();, (*7)

return $app;, (*8)


app/console.php ``` php <?php use KzykHys\Silex\Provider\Console\ConsoleServiceProvider; $app = require __DIR__ . '/bootstrap.php'; $app->register(new ConsoleServiceProvider()); $app['console.commands'] = $app->share($app->extend('console.commands', function (array $commands) { $commands[] = new YourCommand(); return $commands; })); $app->boot(); $app['console']->run();
$ php app/console.php

Accessing "$app" in your command

``` php <?php, (*9)

use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface;, (*10)

class YourCommand extends Command {, (*11)

protected function execute(InputInterface $input, OutputInterface $output)
{
    /* @var \Silex\Application $app */
    $app = $this->getHelper('silex')->getApplication();
}

} ```, (*12)

See Also

License

The MIT License, (*15)

The Versions

29/05 2013

dev-master

9999999-dev

Provides Symfony/Console to Silex application

  Sources   Download

MIT

The Requires

 

by Kazuyuki Hayashi