Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Extending core features and packages
  • hi, extending core features, found doc page:
    http://docs.fuelphp.com/general/extending_core.html But: I use a 3rd party package and want to extend it, but dont want to edit original files.
    So whats the correct way to extend a package?
  • Hard to say, depends on the package. If it is namespaced and has that registered as a core_namespace then you can do it exactly like the core classes. In other cases it depends on if the package allows for it. One alternative is always available: add a replacement class. You copy paste the original class (including namespace) and put it somewhere outside the package where you edit it. Once you're done you add the class manually to the autoloader in your app bootstrap (or in another package) to tell the autoloader where to find the class.
    http://docs.fuelphp.com/classes/autoloader.html#/method_add_class
  • thx, it's namespaced, so I could solve it like this ... (if anybody interessted in) ... /classes/package.php
    namespace Package;
    class MyPackage extends Package {
    

    bootstrap.php
    Autoloader::add_classes(array(
     'Package\\MyPackage' => APPPATH.'classes/package.php' 
    ));
    

Howdy, Stranger!

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

In this Discussion