PHPackages                             nikoutel/phpdebugr - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. nikoutel/phpdebugr

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

nikoutel/phpdebugr
==================

A debugging tool for inspecting variables.

v1.2(7y ago)3382MPL-2.0PHPPHP &gt;=5.3

Since Apr 26Pushed 7y ago2 watchersCompare

[ Source](https://github.com/nikoutel/PHPDebugr)[ Packagist](https://packagist.org/packages/nikoutel/phpdebugr)[ RSS](/packages/nikoutel-phpdebugr/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (4)Used By (2)

PHPDebugr
=========

[](#phpdebugr)

**A debugging tool for inspecting variables.**

A quick and effective debugging tool/solution if you do not have access to (or don't want to use) a single-stepping debugger like xdebug. Powerful 'var\_dump' replacement with logging capabilities and console support.

Usage
-----

[](#usage)

`Debugr::eDbg(mixed $var [, string $description [, string $writeOption]])``Debugr::eDbg` writes the value of `$var` and the `$description` text *(optional)* to the output, defined in `config.php`, using the `$writeOption`. Possible options for the output are: `Screen`, `Log`, `Console`, and `None`.
*(The predefined value is `Screen`)*

`Debugr::eDbgScreen(mixed $var [, string $description [, string $writeOption]])``Debugr::eDbgScreen` writes the value of `$var` to the screen regardless of the default `config.php` file entry.

`Debugr::eDbgLog(mixed $var [, string $description [, string $writeOption [, sting|null $logFile]])``Debugr::eDbgLog` writes the value of `$var` to the log file defined in `config.php`, set through `Debugr::setLogfile()` or passed through the `$logFile` parameter.

`Debugr::eDbgConsole(mixed $var [, string $description [, string $writeOption]])``Debugr::eDbgConsole` writes the value of `$var` to the browsers console.

`Debugr::setLogFile(string $logFile)``Debugr::setLogFile` sets the log file, overwriting the `config.php` file option.

### Parameters

[](#parameters)

***var***

The variable to inspect

***description****(optional)*

Text to be displayed before the variable value e.g. `The value of $thisVar is:`

***writeOption****(optional)*

The way the output is written/formatted:

###### options:

[](#options)

>

`e` or `echoes` – *for `echo`-like output*
`v` or `varDump` – *for `var_dump`-like output*
`r` or `printR` – *for `print_r`-like output*
`x` or `export` – *for `var_export`-like output*

If you omit this, the defaults are used. For scalar types *(integer, double, string)* the default is `echoes` and for composite types *(array, object, resource, boolean, null, unknown type*) the default is `varDump`. The defaults can be changed in the `config.php` file.
*(I know boolean is technically scalar and Null is, well, Null, but they are fitting better in the composite group)*

Logging
-------

[](#logging)

Output can be logged to a file by specifying `Log` as output in `config.php` or by calling `Debugr::eDbgLog()` directly.

The log file used can be defined as follows:

###### options:

[](#options-1)

- Configuration option in`config.php`
     The default option. Predefined as `output.log`.
- Through `Debugr::setLogfile()`
     Takes precedence over the `config.php` option.
- As 4th parameter of `Debugr::eDbgLog()`
     Has the highest priority. Is only set for this call.

(See example below)

Notes
-----

[](#notes)

If `None` is used as the default output, `Debugr::eDbg` will not produce any output. This is not true for `eDbgScreen`, `eDbgLog`, `eDbgConsole`. You can disable all by setting: `disable:true` in `config.php`. This is some sort of kill switch.

Install
-------

[](#install)

Composer or no composer? That is the question!

**composer:**

```
composer require nikoutel/phpdebugr

```

**no composer:**
Just dump the files in you project and use as shown below.

```
require('path/to/Debugr/src/Debugr.php');
use Nikoutel\Debugr\Debugr;
```

How to use
----------

[](#how-to-use)

Use `eDbg` to output the variable values to the default output. On a developer server you can choose `Screen`. If you have to use it on a production server use `Log` and all `Debugr::eDbg` calls will now write to the log file instead of the screen.

On some occasions e.g. when outputting a variable on screen breaks the site layout you can use `eDbgConsole` to use the browser console regardless of the default output. In the same way you can use `eDbgScreen`, `eDbgLog`, according to the situation and your needs.

The value is formatted according to the variables type or the `writeOption` given.

Requirements
------------

[](#requirements)

- PHP 5.3 (min)
- *(optional)* The "Multibyte String" php extension (mbstring) - Allows multibyte characters to be used in log filenames

Examples
--------

[](#examples)

```
// composer:
require __DIR__ . '/vendor/autoload.php';
use Nikoutel\Debugr\Debugr;

// no composer:
require('path/to/Debugr/src/Debugr.php');
use Nikoutel\Debugr\Debugr;
```

> ```
> $varB = 42;
> Debugr::edbg($varB);
> ```
>
>
>
> 42

> ```
> $varC = 103993/33102;
> Debugr::edbg($varC, 'the value of pi is');
> ```
>
>
>
> the value of pi is: 3.1415926530119

> ```
> $varA = 'Guru Meditation';
> Debugr::edbg($varA, NULL, 'v');
> ```
>
>
>
> string(15) "Guru Meditation"

> ```
> $varE = array(
>     'black jack',
>     'gin rummy',
>     'hearts',
>     'bridge',
>     'checkers',
>     'chess',
>     'global thermonuclear war');
> Debugr::edbg($varE, 'Shall we play a game?','r');
> ```
>
>
>
> ```
> >Shall we play a game?:
> Array
> (
>     [0] => black jack
>     [1] => gin rummy
>     [2] => hearts
>     [3] => bridge
>     [4] => checkers
>     [5] => chess
>     [6] => global thermonuclear war
> )
> ```

> ```
> $varF = fopen('secretFile.xml', 'r');
> Debugr::edbgLog($varF);
> fclose($varF);
> Debugr::edbgLog($varF);
> ```
>
>
>
> will produce a log file entry:
>
> ```
> (18/10/2017 17:23:58) /LondonBlue/Secret/getSecret.php
> resource(19) of type (stream)
>
> (18/10/2017 17:23:58) /LondonBlue/Secret/getSecret.php
> resource(19) of type (Unknown)
>
> ```

> ```
> Debugr::edbgLog($varG);                         # writes to output.log defined in config.php
> Debugr::setLogFile(newOutput.log);
> Debugr::edbgLog($varH);                         # writes to newOutput.log
> Debugr::edbgLog($varI, 'v', 'prioOutput.log');  # writes to prioOutput.log
> Debugr::edbgLog($varJ);                         # writes to newOutput.log
> ```

> ```
> $book = new stdClass;
> $book->php = 'PHP Design Patterns, Stephan Schmidt';
> $book->c = 'The C Programming Language, Kernighan & Ritchie';
> $book->unix = 'The unix programming environment, Kernighan & Pike';
> $book->economics = 'Making Millions For Dummies';
> Debugr::edbgConsole($book, '$book');
> ```
>
>
>
> will produce a console output:
>
> [![Screenshot Console](Screenshots/ScreenshotConsole.png)](Screenshots/ScreenshotConsole.png)

License
-------

[](#license)

This software is licensed under the [MPL-2.0](http://www.mozilla.org/MPL/2.0/):

```
    This Source Code Form is subject to the terms of the Mozilla Public
    License, v. 2.0. If a copy of the MPL was not distributed with this
    file, You can obtain one at http://mozilla.org/MPL/2.0/.

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

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 ~4 days

Total

2

Last Release

2572d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/26b8ff0aae33318299950ec6d4e7808d97b7483ea1969f8f50155fa6fcb77583?d=identicon)[nikoutel](/maintainers/nikoutel)

---

Top Contributors

[![nikoutel](https://avatars.githubusercontent.com/u/3975133?v=4)](https://github.com/nikoutel "nikoutel (113 commits)")

---

Tags

consoledebuggerdebuggingloggingconsoleloggingdebuggingdebugger

### Embed Badge

![Health badge](/badges/nikoutel-phpdebugr/health.svg)

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

###  Alternatives

[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M82](/packages/rollbar-rollbar)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[honeybadger-io/honeybadger-laravel

Honeybadger Laravel integration

431.2M](/packages/honeybadger-io-honeybadger-laravel)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)

PHPackages © 2026

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