Details loic-sharma

Profiler

Profiler Bundle

Installation

To install the bundle run the following commands:

php artisan bundle:install profiler

php artisan bundle:publish

Once that is complete you will need to add the bundle to the auto array in the application config file.

Displaying Profiler

There are several ways you can load Profiler onto your site. For example you can simply use a view:

echo View::make('profiler::display');

Of course, you can just nest the view if you want. Or, you can simply use the profiler filter:

public function __construct()
{
    $this->filter('after', 'profiler');
}

Logging

Profiler lets you debug your code easily. You can log a message by doing:

Profiler::log('This is my message!');

Want to benchmark your code? Easy!

Profiler::log_speed('Load time to reach this checkpoint');

Need to watch your memory usage? Just use the log_memory method to see the memory currently used:

Profiler::log_memory('A message to keep track of where I am');

You can even keep track of the memory used by a variable:

$somevariable = 'somevalue';

Profiler::log_memory('my variable', $somevariable);

Of course, you can also log errors:

Profiler::log_error(new Exception, 'Oops I did a mistake!');

Installation

You can install this bundle by running the following CLI command:

php artisan bundle:install profiler

Alternatively you can download it directly from GitHub:
http://github.com/loic-sharma/Laravel-Profiler

Stats

  • Watchers:
  • Forks:
  • Ratings: 6 likes
  • Installs: 2524