PHPackages                             gebruederheitz/wp-debug-log - 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. gebruederheitz/wp-debug-log

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

gebruederheitz/wp-debug-log
===========================

A tiny class and trait to make logging debug output simpler.

1.0.1(3y ago)07GPL-3.0-onlyPHPPHP &gt;=7.3

Since Jul 13Pushed 3y agoCompare

[ Source](https://github.com/gebruederheitz/wp-debug-log)[ Packagist](https://packagist.org/packages/gebruederheitz/wp-debug-log)[ RSS](/packages/gebruederheitz-wp-debug-log/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

Wordpress Debug Helper
======================

[](#wordpress-debug-helper)

*A tiny class and trait to make logging debug output simpler.*

---

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

[](#installation)

via composer:

```
> composer require gebruederheitz/wp-debug-log
```

Make sure you have Composer autoload or an alternative class loader present.

Usage
-----

[](#usage)

This library uses `error_log()` internally to conditionally write messages to Wordpress' debug log file. The single requirement for logging output is that the environment variable `WORDPRESS_ENV` is set and does not equal the string `"production"`.

You can call the `Debug` class' static methods directly:

```
use Gebruederheitz\Wordpress\Debug;

if (Debug::isDebug()) {
    // do dev-instance only things
}

// Writes the message to the logfile whenever WORDPRESS_ENV is set and not
// "production"
Debug::log('My first log message');
Debug::log('I\'m logging a context as well now', [$myVariable]);

// Uses output buffering to capture a var_dump() and write the result to the
// logfile
Debug::dump($myVariable);
Debug::dump($myVariable. 'This is my variable, dumped:');
```

For a more verbose output from different modules, you can use the trait provided, which will prepend your log messages with a namespace:

```
use Gebruederheitz\Wordpress\withDebug;

class MyClass {
    use withDebug;

    public function doSomething($arg = 42): void
    {
        self::debugLog('Doing something with these args:', [$arg]);
        /*
         * Results in:
         * [MyClass] Doing something with these args: 42
         */

         self::debugDump($arg);
    }
}
```

You can also set a custom namespace through a static class attribute:

```
use Gebruederheitz\Wordpress\withDebug;

class MyClass {
    use withDebug;

    protected static $debugNamespace = 'Module:NextL3vel';

    public function doSomething(): void
    {
        $myVar = 42;
         self::debugDump($myVar, 'The answer to question about life, the universe, and everything is');
        /*
         * Results in:
         * [Module:NextL3vel] The answer to question about life, the universe, and everything is
         * (int)42
         */
    }
}
```

Development
-----------

[](#development)

### Dependencies

[](#dependencies)

- PHP &gt;= 7.3
- [Composer 2.x](https://getcomposer.org)
- [NVM](https://github.com/nvm-sh/nvm) and nodeJS LTS (v16.x)
- Nice to have: GNU Make (or drop-in alternative)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

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

Total

2

Last Release

1402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2a201d58341e3ed71321bcb66cb375a8c6efffce7d8fe33244e821afc087c78?d=identicon)[mediocrity](/maintainers/mediocrity)

---

Top Contributors

[![AndreasMaros](https://avatars.githubusercontent.com/u/25008845?v=4)](https://github.com/AndreasMaros "AndreasMaros (5 commits)")

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gebruederheitz-wp-debug-log/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B9.2k](/packages/psr-log)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[graylog2/gelf-php

A php implementation to send log-messages to a GELF compatible backend like Graylog2.

41838.2M138](/packages/graylog2-gelf-php)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[consolidation/log

Improved Psr-3 / Psr\\Log logger based on Symfony Console components.

15462.2M7](/packages/consolidation-log)[datadog/php-datadogstatsd

An extremely simple PHP datadogstatsd client

19124.6M15](/packages/datadog-php-datadogstatsd)

PHPackages © 2026

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