PHP Classes


Recommend this page to a friend!
  Classes of Frank Forte   Quantum PHP   Download  
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: Quantum PHP
Output log messages to show in browser console
Author: By
Last change:
Date: 5 years ago
Size: 2,623 bytes


Class file image Download


QuantumPHP is a PHP and JavaScript library that can log server side variables directly to the developer tools console in various browsers like Firefox Quantum, with or without the use of a browser extension or add-on.


  • PHP 5.6 or later


1. Add QuantumPHP to your project

a) composer require frankforte/quantumphp


b) git clone vendor/frankforte/quantumphp

2. Get QuamtumPHP in your browser:

a) For Firefox, add the following light weight add-on:


b) For Google Chrome, install the Chrome extension:

More information can be found here:


c) copy the JavaScript file into your public directory and include it in your HTML.

for example:

cp vendor/frankforte/quantumphp/QuantumPHP.js public_html/js/QuantumPHP.js

Then add the file to the HTML template

<script src="/js/QuantumPHP.js"></script>

3. Use it in your project:

Add this to your PHP file. The 'add' method will add rich information to the logs in a table format. Note: objects and arrays should be logged with the "add" method: QuantumPHP::add($object);


// Optional if you do not have an autoloader
include 'QuantumPHP.php';

 * Optional debugging mode
 * mode = 1 for Chrome 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::log($_SERVER); // you will need mode 0 for this!
	throw new Exception('Something Bad!!');
catch(Exception $e)

Finally, hit F12 in your browser to open developer tools, and view the output under the "console" tab.

Please submit any issues you have: