PHPackages                             zidizei/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. [CLI &amp; Console](/categories/cli)
4. /
5. zidizei/debug

ActiveLibrary[CLI &amp; Console](/categories/cli)

zidizei/debug
=============

Simple debugging utility for PHP.

0.1.1(11y ago)810.6kMITPHPPHP &gt;=4.3.0

Since Mar 28Pushed 10y ago4 watchersCompare

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

READMEChangelogDependenciesVersions (3)Used By (0)

debug-php
=========

[](#debug-php)

Simple debugging utility for PHP to print out messages to stdout or the browser's JavaScript console, if supported.

Heavily inspired by [debug](https://github.com/visionmedia/debug)for [node.js](http://nodejs.org).

[![Latest Stable Version](https://camo.githubusercontent.com/f6f6d0261cc72cb09f7e1b35c58f6dec4e46d619de4180a9a30ea624a5c1d43c/68747470733a2f2f706f7365722e707567782e6f72672f7a6964697a65692f64656275672f762f737461626c652e737667)](https://packagist.org/packages/zidizei/debug) [![Total Downloads](https://camo.githubusercontent.com/1ba94d1053914ea1aae21550b47dfef8e564b8b50be7e31ecf538b18e6e523a1/68747470733a2f2f706f7365722e707567782e6f72672f7a6964697a65692f64656275672f646f776e6c6f6164732e737667)](https://packagist.org/packages/zidizei/debug) [![License](https://camo.githubusercontent.com/facde0d1a084c5ad08f49c9c510cc6fcf99ce94c543c3efe35b1dd1d3c0348d9/68747470733a2f2f706f7365722e707567782e6f72672f7a6964697a65692f64656275672f6c6963656e73652e737667)](https://packagist.org/packages/zidizei/debug)

Installation
------------

[](#installation)

Use [Composer](http://getcomposer.org) and add this to your `composer.json`:

```
"require": {
    "zidizei/debug", "~0.1.1"
}

```

Usage
-----

[](#usage)

**debug-php** lets you print out short debbuging messages for your PHP project either to stdout or to the JavaScript console of your browser, in case you are using this library on your website.

```
require "vendor/autoload.php";

// initiate debug profile named 'parser'
\Debug\profile("parser");

\Debug\debug("Parsing some stuff now");
/* Parse the stuff */
\Debug\debug("Stuff successfully parsed");

// close the current debug profile (in this case 'parser')
\Debug\profile();

```

The above code will produce something like this when run using a web server and browser:

[![parser debug](https://camo.githubusercontent.com/7d0bb9db989616e593ef4364a5bf68ca195b6f8b8c056e53963a54921cf96c17/68747470733a2f2f7061747269636b6c2e616d2f61747469632f64656275672d7068702f64656275672d7061727365722e706e67)](https://camo.githubusercontent.com/7d0bb9db989616e593ef4364a5bf68ca195b6f8b8c056e53963a54921cf96c17/68747470733a2f2f7061747269636b6c2e616d2f61747469632f64656275672d7068702f64656275672d7061727365722e706e67)

Output to `stdout` will look more or less the same using colors defined by your shell.

### Disabling debugging messages

[](#disabling-debugging-messages)

By default, **debug-php** is good to go by just calling its methods. Since 0.1.1 you can call `\Debug\off()` to explicitly disable debugging messages. In combination with `\Debug\on()`, this could be used to programmatically decide to skip debug messages for certain sections of your code.

### Multiple Profiles

[](#multiple-profiles)

You can use *profiles* to better distinguish some of your debug messages. The example above only uses one profile by calling:

```
\Debug\profile("parser")

```

If a *profile* by that name already exists, it will be closed. You can close the currently active (as in last opened) profile by omitting the parameter:

```
\Debug\profile()

```

If there are no active profiles, it will open a default one (aptly named *default*). Note that there has to be **at least one** profile open for debugging.

The following code example demonstrates the use of multiple debugging profiles:

```
require "../vendor/autoload.php";

// initiate debug profile named 'parser'
\Debug\profile("parser");

\Debug\debug("Parsing some stuff now");
/* Parse the stuff */
\Debug\debug("Stuff successfully parsed");

// initiate debug profile named 'worker'
\Debug\profile("worker");

\Debug\debug("Working with the stuff now");
/* Work with the parsed stuff */
\Debug\debug("Stuff successfully worked with.. or something like that.");

// close the current debug profile (in this case 'worker')
\Debug\profile();

// close the current debug profile (in this case 'parser')
\Debug\profile();

```

The above code will produce something like this when run using a web server and browser:

[![multiple profiles debug](https://camo.githubusercontent.com/5e4fe504f3c3e45d0fcd99a6100bdf2d0b6a794cb14c0bf35a85286318959393/68747470733a2f2f7061747269636b6c2e616d2f61747469632f64656275672d7068702f64656275672d70726f66696c65732e706e67)](https://camo.githubusercontent.com/5e4fe504f3c3e45d0fcd99a6100bdf2d0b6a794cb14c0bf35a85286318959393/68747470733a2f2f7061747269636b6c2e616d2f61747469632f64656275672d7068702f64656275672d70726f66696c65732e706e67)

Output to `stdout` will look more or less the same using colors defined by your shell.

### Time measurements

[](#time-measurements)

The milliseconds at the end of each debug line indicate the time difference between the execution of the current debug message and the previous one.

Additionally, each profile duration is measured and displayed once it has been closed.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Every ~323 days

Total

2

Last Release

4108d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.3.0

0.1.1PHP &gt;=4.3.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8c47900485c265dee31faa8ef78cd379017a3d2c701b2ee9d3e161cbf3db0d83?d=identicon)[zidizei](/maintainers/zidizei)

---

Top Contributors

[![zidizei](https://avatars.githubusercontent.com/u/470408?v=4)](https://github.com/zidizei "zidizei (23 commits)")

---

Tags

consolejavascriptdebug

### Embed Badge

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

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B11.3k](/packages/symfony-console)[psy/psysh

An interactive shell for modern PHP.

9.8k545.6M719](/packages/psy-psysh)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[wp-cli/php-cli-tools

Console utilities for PHP

68325.0M367](/packages/wp-cli-php-cli-tools)[buggregator/trap

A simple and powerful tool for debugging PHP applications.

2591.7M40](/packages/buggregator-trap)

PHPackages © 2026

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