lexpress / console-service-provider
This package is abandoned and no longer maintained.
No replacement package was suggested.
Console Service Provider for Silex Applications
v1.0.0
2013-09-22 22:20 UTC
Requires
- silex/silex: ~1.0
- symfony/console: ~2.3
This package is not auto-updated.
Last update: 2020-01-24 15:18:01 UTC
README
The ConsoleServiceProvider enable Symfony Console in Silex make easy to register command from any other service provider.
Parameters
- console.name (optional): The name of your application.
- console.version (optional): The version of your application.
Services
- console: The Console Application. Use
$app['console']->run()
.
Registering
Installation:
- Use the official Git repository (https://github.com/LExpress/ConsoleServiceProvider);
- Install it via Composer (lexpress/console-service-provider on Packagist).
Register the service provider in your Silex application.
$app->register(new LExpress\Silex\ConsoleServiceProvider(), array( 'console.name' => 'Wahou', 'console.version' => '1.0', ));
Register commands
Services named with command.*
are automatically registered to the console.
$app['command.propel.model.build'] = $app->share(function ($app) { return new Propel\Generator\Command\ModelBuildCommand(); });
Running the console application
The Console Application is available in your Silex Application with the service alias console
.
To run it, you can create an executable file in your project.
#!/usr/bin/env php <?php // Load the class loader require __DIR__.'/vendor/autoload.php'; // Initialize your application with the ConsoleServiceProvider $app = require __DIR__.'/app.php'; // Run the console with the default input/output $app['console']->run();
License
ConsoleServiceProvider is licensed under the MIT license.