symfonycomposer-phpsilex

Using the object Silex/Application into a Symfony2 project


I need to use a third party API into a Symfony2 app, which is using composer to manage dependencies. This API is built using Silex, so I need to use a Silex/Application object.

I have manage to get silex by adding

"silex/silex": "1.0.*" 

into composer.json, but when I specify

use Silex/Application

in the controller and

  $app = new Silex\Application();

in the action where I want to manage the third party API, the response is:

Fatal error: Class 'MyApp\MyBundle\MyController\Silex\Application' not found in path\to\my\controller\MyController.php on line 130

It seems like the Silex namespace haven't been loaded.

Any idea about how can I manage to use Silex into Symfony2?


Solution

  • If you exported it as use Silex\Application; then $app = new Application(); or use Silex\Application as SilexApp then $app = new SilexApp();