Run Silex Application in Command Line Run Silex Application in Command Line symfony symfony

Run Silex Application in Command Line


Here's a simple way to do it:

list($_, $method, $path) = $argv;$request = Request::create($path, $method);$app->run($request);

And then on the command line:

$ php console.php GET /


If you want to use silex in a command line, you need to use the Console Component, here a tutorial for silex: http://beryllium.ca/?p=481

Then you are able to call a twig (symfony) service, and to forward an action !

http://symfony.com/doc/current/cookbook/console/console_command.html#getting-services-from-the-service-container