useallfive / doctrine-web-console
Doctrine Web Console Service Provider
Installs: 4 029
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 26
Forks: 1
Open Issues: 1
Requires
- dflydev/doctrine-orm-service-provider: 1.0.*@dev
- silex/silex: ~1.1
This package is not auto-updated.
Last update: 2024-11-04 16:32:44 UTC
README
The doctrine web console allows one to execute doctrine console commands via web browser. This is especially useful when one is required to execute commands in an enviroment which does not allow shell access (e.g. Google App Engine).
Installation
Via composer:
php composer.phar require useallfive/doctrine-web-console dev-master
Mount the controller provider to the /console path.
<?php $app = new Silex\Application(); // ... $app->mount( '/console', new \UseAllFive\DoctrineWebConsole\ConsoleControllerProvider() ) ; $app->run();
You're all set! Visit the the /console
url of your site to use.
Specifying a command path
If a command path is not specified, commands will be executed in the current working directory of the console controller (the web directory of your project). While this is fine for most commands, it's not ideal for a command which requires a path. You can specify a path in the first argument of the ConsoleControllerProvider
constructor.
<?php $app = new Silex\Application(); // ... $app->mount( '/console', new \UseAllFive\DoctrineWebConsole\ConsoleControllerProvider(__DIR__) ) ; $app->run();
Adding commands
Adding your own Doctrine commands to the web console is trivial. We'll add the Doctrine DataFixtures Command for this example.
The second argument of the ConsoleControllerProvider
constructor takes an array of Symfony\Component\Console\Command\Command
instances which is then passed to the Doctrine ConsoleRunner
.
<?php $app = new Silex\Application(); // ... $app->mount( '/console', new \UseAllFive\DoctrineWebConsole\ConsoleControllerProvider( __DIR__, array( new \UseAllFive\Command\LoadDataFixturesDoctrineCommand(), ) ) ) ; $app->run();