Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Error when including external libraries
  • Hi, First - thanks for making FuelPHP, I love it (thanks mainly to Oil) and am trying to transition over from Kohana. One problem: when I try to include external libraries (in this case, Amazon AWS SDK from CloudFusion, and Simple HTML DOM parser), I get a fatal error: ErrorException [ Error ]: Class 'Debug' not found Presumably (since it happened with both of these libraries, which otherwise work fine outside of Fuel), it is some kind of class name conflict with Fuel core. But I do not know what I need to do to get around this. The Amazon library is quite large and complex, so I am reluctant to go making wholesale changes there. Is there something simpler I can do? My code is like this: require_once '/path/to/fuel/app/vendor/aws/sdk.class.php';
    require_once '/path/to/fuel/app/vendor/simple_html_dom/simple_html_dom.php'; By the way, is there a helper in Fuel to include/require an external class, as there is in Kohana? Thanks, Mateo
  • To avoid conflicts, put it in a package, in it's own namespace. For an example, look at my simplepie package, http://github.com/fuel-packages/fuel-simplepie.
  • If you are in a different namespace from Fuel\Core you have to use the "\" before "Debug", so :
    namespace Amazon;
    
    class ClassName {
    
      public static function method()
      {
        \Debug::dump();
      }
    
    }
    

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion