Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
adding legacy php library to fuel app
  • Hi, I am kind of new to fuel, trying to migrate our website to fuel. We use a bunch of php library that don't use object oriented methodology (no classes defined).
    What is the recommended way to add those to fuel?
    Where should i put the php files?
    I'd prefer to avoid putting them in the /public folder if possible (that worked). I've tried using packages, but so far it forced me to refactor the code to wrap functions with a classe and add namespace which i can't afford to do for 3rd party libraries (maybe i did something wrong). some guidance would be appreciated (that doesn't require changing the library code). thanks
  • that worked well.
    thanks for the help!
  • If they are files that just contain procedural functions, you will have to install them in the global namespace to avoid the namespace issues. Which means somewhere in APPPATH. To load them the best option would probably be a require() in your app bootstrap.php. We do the same in the framework with the few supporting functions in fuel/core/base.php, which is loading in the fuel/core/bootstrap.php.

Howdy, Stranger!

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

In this Discussion