Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
  • I've just pushed an initial version of an alternate profiler for FuelPHP Its inspired heavily by the Built in profiler based on PHP Quick Profiler, some improvements include: FuelPHP style - The profiler's style matches the FuelPHP web site and error pages.
    Modular - Profiler tabs can be implemented and added by apps or other packages
    Overidable views - App developers can override the default tabs themes with their own output
    Search and filter - Search output on the client side
    Stays open - Open tabs are track using the url hash, so refreshing the page will keep your position This is a very early commit and hasn't been widely test so am really keen to get feedback
  • Couple of improvements I've made Added shorthand class so you can do \P::c("hello");
    Added inspect method that will output variables as a highlighted javascript expandable tree structure
    Use \Profiler::inspect($variable)
    Using inspect will auto open the profiler and filter by 'inspect' log type
  • I find it a very bad practice to add a class to your app/bootstrap that is part of a package. It should be part of the package itself. It doesn't take up any space if default but not used.
  • Do you mean they should be in added to the autoloader in the packages bootstrap? I agree but because Fuel loads the Profiler before it loads the package's bootstrap it would have no affect in there
    However the app bootstrap is loaded before Fuel loads the Profiler so it has to go in there
  • I've just pushed an update that has two new view types
    minimal is the new default and displays an icon, execution speed and number of queries
    icon just display an icon
    bar is the old default with summaries for each tab
    hidden is hidden when close, it can be opened using the hotkey If you liked the old style all you need to do in your config.php is:
    return array(
     /* ... */
     'profiling' => array(
      'mode' => 'bar',

    new hot key
    you can open the profiler with ctrl+alt+p
    this hot key you can edit using the hotkey config option
    return array(
     /* ... */
     'profiling' => array(
      'hotkey' => 'ctrl+alt+c',

  • I have downloaded package, activated it to autoloader, enabled the profiler and I have one issue. Profiles is running, no errors, but it doesn't show details. In Console box I see "7 messages", but when I click on it, it shows me: This tab has no content to display. And same text is on all other tabs.
    What did I miss? Do I need firephp? Where this should go:
    return array(
        /* ... */
        'profiling' => array( // Whether to enable profiling defaults to false
            'tabs' => array( // An array of tab classes to display, in order. Implementing this will prevent other packages' profiler tabs from automatically appearing and you will have to add them to this array manually.
                'FuelPHProfiler\Tab\Info', // Displays PHP, App, FuelPHP version and env in summary. Displays searchable result of phpinfo() in content.

    into app/config/config.php ? It looks more like app/config/fuelphprofiler.php but it doesn't do anything, if I remove 'FuelPHProfiler\Tab\Info' it is still visible in profiler.
  • What version of Fuel are you using?
    Have you got the latest version of FuelPHProfiler?
    You will see that message if the profiler can't find the view for that tab You do not need firephp
    The config stuff needs to go in your app/config/[$env]/config.php
  • Latest FuelPHP (1.1).
    Latest FuelPHProfiler from github (downloaded now, from master branch) Config is now working - however, I think it would be better to move this to separate config file, per module. This will keep main config.php clean. But, still, on every tab I see "This tab has no content to display". I'll check this, dig a bit more into source and let you know what was the problem.
  • Its in the main config because the aim is to replace the build in profiler and that were the config for the built in profiler goes
    I'm 50/50 on whether it should stay there for that reason or move to its own config
    I can tell you the message is triggered on line 38 of views/profiler.php when the tab doesn't return any content
    If you look on line 30 of classes/tab.php its probably because if it can't find the view file for the tab so it return false, when it should probably throw an exception That wont fix your problem but it might help debugging these kind of issues
  • Got it.
    I have downloaded FuelPHProfiler and created folder for it: fuelphprofiler. However, in /classes/tab.php ther is hardcoded:
     function get_template()
      return PKGPATH."/FuelPHProfiler/views/".$this->template;

    I have removed leading '/' (it was giving me path with two '//', but this is not an issue) and made folder name lowercase. It all works now. Thanks. Maybe path should be a variable, set up in config.php?
  • yeah the // is normally fine (but I will tidy up anyway)
    The lowercase issue I guess is because you are on a case sensitive file system and I am not
    Not used to dealing with lower case file structures, doh!
    Will push a fix later today As for path being a variable in config
    It is already possible to override individual tab template paths by defining something like
    return array(
        /* ... */
        'profiling' => array(
            'views' => array (
                'FuelPHProfiler\Tab\Info' => 'path/to/replacement/template.php',
        /* ... */
  • just pushed a fix
    thanks for your help
  • I was thinking along the lines of the Smarty debugger, that opens a second window to show all information. I would very much prefer that, as it doesn't play havoc with your page layout. I've already had several issues with the current way of including the profiler data in combination with jQuery where code would select elements in the profiler data too, totally destroying the intended layout. In IRC some people already complained that for some of their sites they can't get the profiler to work at all for similar reasons...
  • Ah ok
    I hate the idea of it being (only) in its own window because thats an extra window to manage
    I do like the idea of protecting the page layout
    May an iframe would be a suitable compromise
    Would that prevent these kind of issues
    With pop out window as an option
    In a similar way to the chrome inspector
  • We'll have to see if that solves the issues. Point is to get the profilers HTML out of the DOM of the page. I kinda like that second window. It has a fixed name, so it will be re-used on every page load. I just have it open side by side with the application on my second screen. And while I use the application the debug window just refreshes with every page load, and I can see immediately what is going on, without fiddling with things on my app's page. I do the same with firebug, I don't leave that at the bottom of my browser window, I run it detached in it's own window.
  • Having the same window name could cause problems if you want to compare the profiler output of two different requests
  • True. Maybe make that configurable?
  • thats what I'm thinking and/or have button to popout/popin like firebug/webkit inspector
  • Another question. In classes/profiler.php, line 15:
     'Fuel\\Core\\Profiler' => __DIR__.'/core_replacement.php',
    This file, core_replacement.php, is missing. Error showed up when I enabled DB profiling.
    Can you add this file to repo ? EDIT
    It looks like 'Fuel\\Core\\Profiler' => __DIR__.'/core_replacement.php', should be replaced with:
    'Fuel\\Core\\Profiler' => __DIR__.'/fuelcoreprofiler.php',
    It all works now.
  • yep you are correct Fuel\Core\Profiler is only used by the ORM which I'm not using so missed that (the actual core uses \Profiler Have just pushed a fix
  • Downside of that is that you're still adding HTML elements to the DOM that are foreign to the page. Probably the impact of a single button isn't that much, but still I can think of very common jQuery code that would make the button useless or even disappear from the page. I want to avoid people complaining that the profiler doesn't work with their setup in their application, just because they've managed to code something up that ruins the HTML that the profiler needs (or produces).
  • How are you going to trigger the profiler? Special route, that shows last request? Otherwise your going to have to introduce something to the page, even a keyboard shortcut and event trigger to auto refresh could be messed up by user code.
    Doesn't seem that user friendly to me, I like something that I can keep an eye on mainly for the number of queries I'm making. I'll have to make two requests in to windows.
    Getting it down to an iframe I think would provide the right balance of hard to fuck up but still easy to find and get to.
  • Haven't thought about that. Ideally I don't want it to be configureable anymore, you should be able to activate the profiler on any page load, if in a development environment. Easiest is probably a GET variable ( like "?enable_profiler=1" ). The core can check for this, and remove it from $_GET if detected so it doesn't mess up code that uses GET variables.
  • I have something similar in my configs that I want to move in to the package
    I also have a secret passphrase for production so if you need to can you can enable it there ?enable_profiler for dev
    ?enable_profiler=my_secret for others It also store whether it is enabled or not in the session so you dont have to do it every time
  • @msaspence, Can't contact you on github (no email address defined), so I'll do it here. We're thinking about replacing the current Profiler for FuelPHP 2.0, and I like a lot of the features you have built into your profiler. Would it be ok for you if we use yours as the basis for our new profiler?
  • Yeah I'ld be thrilled
    Let me know if you want any input/help
    Would love to hear what changes/direction you are planing to take it in
    I've noticed a few people watching it on GitHub but so far no real feedback (positive or negative) so keen to hear what other peoples thoughts are about how it could be better
    my email is my github tag with the host as so feel free to get in touch there

Howdy, Stranger!

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

In this Discussion