Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Overriding Config files in runtime
  • Hi,

    I'm trying to override config files from in runtime.  Specifically I am trying to overwrite the email configuration.

    What I do is the something like this:

    Config::set('email.defaults.driver',     $driver);
    Config::set('email.defaults.from.email',    $from_mail);
    Config::set('email.defaults.from.name',     $from_name);


    But I don't see any effect, when using the email sending, the configuration of the file (email.php) is still being used.
    Is there something I am not taking into consideration?

    Thanks!
  • HarroHarro
    Accepted Answer
    The Email package class loads its config when it is loaded for the first time. This will overwrite any config you've set before.

    So the quick fix is to make sure it is loaded before you make changes. You can do that using

    class_exists('Email', true);

    which will trigger the class load and call its static constructor .
  • Thanks, It works for me!

Howdy, Stranger!

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

In this Discussion