PHPackages                             hazardland/debug - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. hazardland/debug

ActiveLibrary[Debugging &amp; Profiling](/categories/debugging)

hazardland/debug
================

php variable debug

1.0.1(9y ago)183.0k6[3 issues](https://github.com/hazardland/debug.php/issues)MITPHPPHP &gt;=5.4.21

Since Jan 31Pushed 8y ago2 watchersCompare

[ Source](https://github.com/hazardland/debug.php)[ Packagist](https://packagist.org/packages/hazardland/debug)[ Docs](http://github.com/hazardland/debug.php)[ RSS](/packages/hazardland-debug/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

function debug ($object)
========================

[](#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:

[![](./demo/php-debug.png)](./demo/php-debug.png)

Example of cli mode output

[![](./demo/php-cli-debug.png)](./demo/php-cli-debug.png)

Or

[![](./demo/php-visually-debug-array.png)](./demo/php-visually-debug-array.png)

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:

[![](./demo/php-debug-object.png)](./demo/php-debug-object.png)

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

[![](./demo/php-debug-object-expand.png)](./demo/php-debug-object-expand.png)

Putting title on debug:

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

[![](./demo/php-debug-pi.png)](./demo/php-debug-pi.png)

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");
```

[![](./demo/php-visually-debug-array.png)](./demo/php-visually-debug-array.png)

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);
```

[![](./demo/php-visually-debug-array-full.png)](./demo/php-visually-debug-array-full.png)

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");
```

[![](./demo/php-log-variable.png)](./demo/php-log-variable.png)

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

[![](./demo/php-debug-sublime-protocol.png)](./demo/php-debug-sublime-protocol.png)

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"

```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3437d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2015121?v=4)[BIOHAZARD](/maintainers/hazardland)[@hazardland](https://github.com/hazardland)

---

Top Contributors

[![hazardland](https://avatars.githubusercontent.com/u/2015121?v=4)](https://github.com/hazardland "hazardland (27 commits)")

---

Tags

debugger-visualizerphpsublimedebug

### Embed Badge

![Health badge](/badges/hazardland-debug/health.svg)

```
[![Health](https://phpackages.com/badges/hazardland-debug/health.svg)](https://phpackages.com/packages/hazardland-debug)
```

###  Alternatives

[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k887.9M9.2k](/packages/symfony-var-dumper)[barryvdh/laravel-debugbar

PHP Debugbar integration for Laravel

19.3k130.0M722](/packages/barryvdh-laravel-debugbar)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.3k1.7M56](/packages/fruitcake-laravel-debugbar)[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k26.7M62](/packages/php-debugbar-php-debugbar)[kint-php/kint

Kint - Advanced PHP dumper

2.8k20.2M301](/packages/kint-php-kint)[tracy/tracy

😎 Tracy: the addictive tool to ease debugging PHP code for cool developers. Friendly design, logging, profiler, advanced features like debugging AJAX calls or CLI support. You will love it.

1.8k25.1M1.4k](/packages/tracy-tracy)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
