PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, January 7, 2022

[FIXED] Using the object Silex/Application into a Symfony2 project

 January 07, 2022     composer-php, silex, symfony     No comments   

Issue

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();



Answered By - olegkhuss
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing