Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Package Dependencies
  • Any thoughts? I'm porting my payments library from CI to Fuel and I need a curl library as a dependency (the alternative is embedding all the curl stuff within the class). How should dependencies be handled? Checking if a core namespace (ie Curl) exists, and if not, throwing an exception?
  • There is curl support in the current core as part of the Rest class. You can load it directly by using
    $curl = new \Rest_Curl();
    

    Maybe you can use that?
  • Ah, right on. I've been off in CodeIgniter land for a spell and didn't know this had been added. Thanks for the heads up = ) On dependencies though (let's just assume the dependency is a package, not part of the core), what path do you recommend?
  • I would say check the dependencies either in your package bootstrap (probably the most logical place), or in the _init() of your main class (if such a thing exists). It is a good question though, and something we need to document also for modules, as you will get packages or modules that are written for a specific Fuel release, and might not work in newer releases. In case of packages, you can check if a package is loaded by calling \Package::loaded('dependency') in 1.1/develop. Something similar is on the way for modules.
  • Good to know. Thanks a lot!

Howdy, Stranger!

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

In this Discussion