Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Can the profiler be enabled from anywhere else but config?
  • Hey guys, is there a way to enable the profiler from a package, library or a controller? I want it to be visible for developer access users only
  • This has been asked before, so a search should give you the answer.

    I personally use this in my app config:
    'profiling' => Fuel::$env !== 'production' and isset($_GET['profile']),
    which means you can activate the profiler on a per-request basis by adding '?profile' to the URL, but only if you're not in production.
  • Thanks, but this is not it. Found a solution in this other thread. Too bad it's not like in CI where you can just enable it with $this->output->enable_profiler(TRUE); (yes I know that the profiler is always enabled in Fuel, just not always shown)
  • The profiler is only enabled when you enable it in the config, if not it's not loaded, only the Profiler class itself is loaded (because the internal profiling commands are still called).

    And what's the difference between
    $this->output->enable_profiler(TRUE);
    and
    \Profiler::init();
  • for one, it's not working when I use it in an action inside a controller
  • HarroHarro
    Accepted Answer
    You'll also have to tell Fuel you've manually activated it, otherwise the output will not be generated:

    \Fuel::$profiling = true;

    Which I agree can be more efficient, so I've moved everything into Profiler::init() for 1.5.
  • Harro, you are the man, thanks !

Howdy, Stranger!

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

In this Discussion