dev-master
9999999-devPHP Quick Profiler Fork
The Requires
- php >=5.3.0
by Ryan Campbell
by Steven Surowiec
Wallogit.com
2017 © Pedro Peláez
PHP Quick Profiler Fork
Version 2, (*1)
by Steven Surowiec steven.surowiec@gmail.com, (*2)
converted to Composer, (*3)
by dubcanada, (*4)
PHP Profiler is a fork of PHP Quick Profiler by Ryan Campbell of Particletree, (*5)
Setup is very easy and straight-forward. There are five primary steps that need to be done., (*6)
Setting up PHP Profiler is quite simple. Below is a short code sample of the latest version., (*7)
$profiler = new Profiler_Profiler();
Profiler_Console::logSpeed('Start Sample run');
Profiler_Console::logMemory($object);
Profiler_Console::logSpeed('End Sample run');
$profiler->display();
Exceptions can also be logged:, (*8)
try {
// Some code goes here
}
catch (Exception $e) {
Profiler_Console::logError($e, $e->getMessage());
}
Database queries can be logged as well:, (*9)
Profiler_Console::logQuery($sql); // Starts timer for query $res = mysql_query($sql); Profiler_Console::logQuery($sql); // Ends timer for query
or manually, (*10)
$start = microtime(true); $res = mysql_query($sql); $end = microtime(true); Profiler_Console::logQueryManually($sql, null, $start, $end);
Using a custom callback to explain queries for console, (*11)
$profiler = Profiler_Profiler(array('query_explain_callback' => array('My_Class', 'someMethod')));
Profiler_Console::logQuery($sql); // Starts timer for query
$res = mysql_query($sql);
Profiler_Console::logQuery($sql); // Ends timer for query
$profiler->display();
class My_Class {
// $sql gets passed in with 'EXPLAIN' already added.
public static function someMethod($sql) {
$res = mysql_query($sql);
return mysql_fetch_assoc($res);
}
}
PHP Profiler lets you pass in some configuration options to help allow it to suit your own needs., (*12)
For additional documentation and code samples see the wiki., (*13)
Below are some of the features of PHP Profiler, (*14)
Using PHP Profiler on your site? Let me know! If you don't want to be featured here just say so, but I still like knowing how people are using PHP Profiler so send me a message or an email and let me know., (*15)
PHP Quick Profiler Fork