PHPackages                             fabacino/debug-functions - 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. fabacino/debug-functions

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

fabacino/debug-functions
========================

Debug functions for PHP

v0.2.0(5y ago)124MITPHPPHP &gt;=7.2CI failing

Since Sep 24Pushed 5y ago1 watchersCompare

[ Source](https://github.com/fabacino/php-debug-functions)[ Packagist](https://packagist.org/packages/fabacino/debug-functions)[ RSS](/packages/fabacino-debug-functions/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (7)Versions (4)Used By (0)

Debug functions for PHP
=======================

[](#debug-functions-for-php)

[![CI](https://github.com/fabacino/php-debug-functions/workflows/CI/badge.svg)](https://github.com/fabacino/php-debug-functions/workflows/CI/badge.svg)[![codecov](https://camo.githubusercontent.com/c905e41c38144311dea9577da1cd81d7e0be61c0d26e08e6200cd13c60ba9ff4/68747470733a2f2f636f6465636f762e696f2f67682f6661626163696e6f2f7068702d64656275672d66756e6374696f6e732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/fabacino/php-debug-functions)

A collection of simple debug functions which might be helpful in case a full-fledged debugger is not available.

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

[](#requirements)

The following versions of PHP are supported:

- PHP 7.2
- PHP 7.3
- PHP 7.4

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

[](#installation)

```
composer install --dev fabacino/debug-functions

```

Usage
-----

[](#usage)

- `dbg`: Print out debug value.
- `dbgr`: Return debug value.
- `dbglog`: Log debug value into file.
- `dbginit`: Initialize debug settings.

The functions accept any value for debugging, as long as it can be passed as a variable.

Examples
--------

[](#examples)

### Print values to standard output

[](#print-values-to-standard-output)

```
dbg(123);
dbg('a string');
dbg([
    'token' => 'dp83kspo',
    'is_default' => true
]);
```

```
// Output
123
a string
Array
(
    [token] => dp83kspo
    [is_default] => true
)

```

When running in a non-CLI environment the ouput is wrapped around `pre` tags for better formatting.

Use `dbginit` or the flag `USE_VARDUMP` in case you prefer `var_dump`:

```
dbginit(['use_vardump' => true]);
dbg(123);
// or
dbg(123, Debug::USE_VARDUMP);
// which is the same as
dbg(123, 1);
```

```
// Output
int(123)
string(8) "a string"
array(2) {
  'token' => string(8) "dp83kspo"
  'is_default' => bool(true)
}

```

Use `dbginit` or the flag `USE_HTMLENTITIES` in case you want to encode HTML entities:

```
dbginit(['use_htmlentities' => true]);
dbg('important');
// or
dbg('important', Debug::USE_HTMLENTITIES);
// which is the same as
dbg('important', 2);
```

```
// Output
&lt;b&gt;important&lt;/b&gt;

```

### Save debug output in variable

[](#save-debug-output-in-variable)

```
// dbgr is the same as dbg, except that the output is returned instead of printed.
$dbg = dbgr(123);
```

### Log debug output to file

[](#log-debug-output-to-file)

```
// dbglog is the same as dbg, except that the output is logged instead of printed.
dbginit(['log_file' => '/path/to/logfile']);
dbglog($this->doSomething());
```

Alternatively you can pass your own PSR-3 compatible logger:

```
$logger = new YourLogger();
...
dbginit(['logger' => $logger]);
dbglog($this->doSomething());
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](https://github.com/fabacino/php-debug-functions/blob/master/LICENSE) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

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

Total

2

Last Release

2189d ago

PHP version history (2 changes)v0.1.0PHP &gt;=7.0

v0.2.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14901115?v=4)[Fabian Wiget](/maintainers/fabacino)[@fabacino](https://github.com/fabacino)

---

Top Contributors

[![fabacino](https://avatars.githubusercontent.com/u/14901115?v=4)](https://github.com/fabacino "fabacino (43 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[filp/whoops

php error handling for cool kids

13.2k402.4M1.4k](/packages/filp-whoops)[symfony/error-handler

Provides tools to manage errors and ease debugging PHP code

2.7k651.8M581](/packages/symfony-error-handler)[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M40](/packages/php-debugbar-php-debugbar)[symfony/ai-mate

AI development assistant MCP server for Symfony projects

1624.9k11](/packages/symfony-ai-mate)[koriym/xdebug-mcp

Universal PHP Xdebug MCP Server with AI-optimized debugging support

4011.6k1](/packages/koriym-xdebug-mcp)

PHPackages © 2026

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