Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Overwrite default class in Package?
  • Hey, is there a simple way to overwrite a default class (at example Lang) over a package?

    If I add the class in fuel/app/bootstrap or in package/bootstrap to Autoloader I have no effects an the __() function expected an error that the class Lang not exist?
  • Core classes are loaded from the global namespace, and aliased by the autoloader from \Fuel\Core to the global namespace.

    So if you want your class to replace the core class, it has to be present in the global namespace.

    That means that if you add your class to a package (which is required to have a namespace, and it must be equal to the package name), you have to alias your package namespace to global.

    You do this in the package bootstrap. Have a look at the Auth package on how that is done.

Howdy, Stranger!

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

In this Discussion