All Projects → hazardland → debug.php

hazardland / debug.php

Licence: other
nice single function php variable debug with formatted html or colored command line output support

Programming Languages

PHP
23972 projects - #3 most used programming language
Batchfile
5799 projects

Projects that are alternatives of or similar to debug.php

themeX
The ultimate UNIVERSAL syntax color theme generator that let's you build your color scheme in just one file and compile for a wide range of different editors.
Stars: ✭ 26 (+73.33%)
Mutual labels:  sublime
sublime-import-js
Sublime Text plugin for ImportJS
Stars: ✭ 24 (+60%)
Mutual labels:  sublime
Milotic
Color Full Theme for All Text Editors!
Stars: ✭ 23 (+53.33%)
Mutual labels:  sublime
vscode-expand-selection-to-scope
Extension that introduces a command to incrementally expand the selection to the nearest outer scope.
Stars: ✭ 17 (+13.33%)
Mutual labels:  sublime
android-sdk
AppSpector is a debugging service for mobile apps
Stars: ✭ 39 (+160%)
Mutual labels:  debugger-visualizer
ListDebuggerVisualizer
Visual Studio debugger visualizer for List<T> or more precisly visualizer for instances of the classes that implement IList.
Stars: ✭ 16 (+6.67%)
Mutual labels:  debugger-visualizer
sublime-jasmine
Jasmine syntax, snippets and commands
Stars: ✭ 24 (+60%)
Mutual labels:  sublime
one-themes
One Dark and One Light Themes
Stars: ✭ 14 (-6.67%)
Mutual labels:  sublime
sublime-live-server
🌍️ Launch a Development Server directly from Sublime Text
Stars: ✭ 49 (+226.67%)
Mutual labels:  sublime
sublime-elementary
ElementaryOS inspired UI theme for Sublime Text 2 and Sublime Text 3.
Stars: ✭ 35 (+133.33%)
Mutual labels:  sublime
bolt-sublime
Syntax highlighting for Bolt and Sublime
Stars: ✭ 26 (+73.33%)
Mutual labels:  sublime
Golite
Add essential language support for the Go language to Sublime Text 3.
Stars: ✭ 14 (-6.67%)
Mutual labels:  sublime
sublime-text-2-wpseek
wpseek.com WordPress Developer Assistant for Sublime Text 2 / 3
Stars: ✭ 19 (+26.67%)
Mutual labels:  sublime
elixir-sublime-syntax
The most powerful Elixir for the most Sublime experience.
Stars: ✭ 28 (+86.67%)
Mutual labels:  sublime
Find-PHP-Vulnerabilities
🐛 A plug-in of sublime 2/3 which is able to find PHP vulnerabilities
Stars: ✭ 57 (+280%)
Mutual labels:  sublime
ProColors
A collection of coding themes for syntax highlighting and the editors that are designed to be available in dark and light modes with a very high precision of harmony and token definition coverage.
Stars: ✭ 94 (+526.67%)
Mutual labels:  sublime
sublime-jsx
Simple Sublime Text 3 JSX implementation
Stars: ✭ 24 (+60%)
Mutual labels:  sublime
stylus-clean-completions
Sublime Text 3 Package with stylus completions
Stars: ✭ 16 (+6.67%)
Mutual labels:  sublime
wollok
Wollok Programming Language
Stars: ✭ 54 (+260%)
Mutual labels:  sublime
sourcegraph-sublime
Sourcegraph for Sublime Text 3
Stars: ✭ 16 (+6.67%)
Mutual labels:  sublime

function debug ($object)

function debug (mixed $object, string/boolean $title=null, boolean/string $plain=false, integer $limit=6)

debug is a single function for visually analything / logging complex deep level objects and arrays.

Example of debug call html output:

Example of cli mode output

Or

Let us have an example classes (check ./demo/demo.php)

	class test1
	{
		public $string = "Test string";
		public $boolean = true;
		public $integer = 17;
		public $float = 9.99;
		public $array = array ('bob'=>'alice',true=>false,1=>5,2=>1.4);
		public $object;
	}

	class test2
	{
		public $another;
	}

	class test3
	{
		public $string1 = "3d level";
		public $string2 = "123";
		public $complicated;
	}

	class test4
	{
		public $enough = "Level 4";
		public $something = "Thanks for the fish!";
	}

And intialize them in a following manner:

	$test = new test1 ();
	$test->object = new test2();
	$test->object->another = new test3 ();
	$test->object->another->complicated = new test4 ();

Now let us start debugging $test1. A simpliest call:

	debug ($test);

Will output following:

Note that object of class test3 is collapsed and only first property is visible you can unfold it by clicking + or you can just debug object with everything expanded by calling:

	debug ($test, true);

So now we see hidden parts of our object by default

Putting title on debug:

	$pi = 3.14159265359;
	debug ($pi, "hello this is pi");

To have both expanded and titled debug we should just put * symbol in the begining of title string like this:

	$hm = array (1=>array(2=>array(3=>array(4=>array(5=>array(6=>array(7=>array(8=>"Last depth we created"))))))));
	debug ($hm, "* A very complicated expanded array");

On a depth level 6 (considering starting level is 0) only ... is visible because of depth rendering limit which is by default 6. To unlock other levels we should incrase limit.

debug ($hm, "* More levels", false, 10);

Third parameter is for plain text output if you pass true

debug ($test, "Output something as plain text", true);

It will output something like following indented with 4 space tabs:

Output something as plain text
-------------------
string : "Test string"
boolean : true
integer : 17
float : 9.99
array (array)
    bob : "alice"
    1 : 5
    2 : 1.4
object (test2)
    another (test3)
        string1 : "3d level"
        string2 : "123"
        complicated (test4)
            enough : "Level 4"

To log plain text output in file just pass file path as a third parameter

debug ($test, date('Y-m-d H:i:s').": Save plain text to file ", "./test.log");

And lastly if you are using subl-protocol plugin for sublime (https://github.com/thecotne/subl-protocol) you can unfold debug backtrace and with one click in browser jump on the specific file and line in sublime text editor:

To debug in error log use 'error_log' in 3d parameter:

	debug ($_GET,'GET','error_log');

To view error log nicely formated use:

tail -f error_log | grep --line-buffered "\n--" | sed "s/\\\n/\\n/g"

Or if you want all other error log messages:

tail -f error_log | sed "s/\\\n/\\n/g"
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].