1. Go to this page and download the library: Download frankforte/quantumphp library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
frankforte / quantumphp example snippets
// Optional if you do not have an autoloader
ome and Firefox
* mode 2 for just Firefox
* mode 3 for just Chrome
* mode 0 when you have a HUGE-MONGOUS log, and
* HTTP headers break the server or browser...
* WARNING: mode 0 will echo the log in an HTML comment, so
* no more http headers can be sent once you call QuantumPHP::send()
* (unless you use output buffering)
* defaults to mode 2
*/
QuantumPHP::$MODE = 2;
// Optional debug size. Defaults to 5kB
QuantumPHP::$HEADER_LIMIT = 16000;
// Logging strings
QuantumPHP::log('Regular log');
QuantumPHP::warn('Regular warn');
QuantumPHP::error('Regular error');
// Logging strings, objects, or arrays
QuantumPHP::add('Hello console table!');
QuantumPHP::add('Something Bad','error');
QuantumPHP::add('Something Really Bad','critical');
// QuantumPHP::add($_SERVER); // you will need mode 0 for this!
try
{
throw new Exception('Something Bad!!');
}
catch(Exception $e)
{
\QuantumPHP::add('test','warning',$e);
}
// Logging data in a table
// objects can be expanded in Firefox console table, but not Chrome:
$obj = new stdClass();
$obj->name = 'test class';
$obj->items = [1,2,3];
$lines = [];
$lines[] = [
'Time' =>round(microtime(true),8)
,'Level' => 'status'
,'Comment' => $obj // Chrome just shows {...}
,'Function' => debug_backtrace()[0]['function']
,'File' => __LINE__.' - '.__FILE__
];
$lines[] = [
'Time' =>round(microtime(true),8)
,'Level' => 'status'
,'Comment' => 'Strings are ok in Chrome'
,'Function' => debug_backtrace()[0]['function']
,'File' => __LINE__.' - '.__FILE__
];
QuantumPHP::table($lines);
QuantumPHP::send();