PHPackages                             florianwolters/component-core-debugprint - 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. florianwolters/component-core-debugprint

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

florianwolters/component-core-debugprint
========================================

The Debug Print Method implementation pattern as a PHP component.

v0.3.0(11y ago)07893LGPL-3.0+PHPPHP &gt;=5.4

Since Sep 24Pushed 11y ago1 watchersCompare

[ Source](https://github.com/FlorianWolters/PHP-Component-Core-DebugPrint)[ Packagist](https://packagist.org/packages/florianwolters/component-core-debugprint)[ Docs](http://github.com/FlorianWolters/PHP-Component-Core-DebugPrint)[ RSS](/packages/florianwolters-component-core-debugprint/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (10)Versions (4)Used By (3)

Component\\Core\\DebugPrint
===========================

[](#componentcoredebugprint)

**Component\\Core\\DebugPrint** is a simple-to-use [PHP](https://php.net "PHP: Hypertext Preprocessor") component that provides the *Debug Print Method* implementation pattern as an [interface](https://php.net/language.oop5.interfaces "PHP: Interfaces")and a [trait](https://php.net/language.oop5.traits "PHP: Traits").

[![Build Status](https://camo.githubusercontent.com/dc838dd15bdb58001c2dfc50403bb2996ce608be72547668c86fccff198e9811/68747470733a2f2f7472617669732d63692e6f72672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d44656275675072696e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/FlorianWolters/PHP-Component-Core-DebugPrint)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/14bd42329ac05ffd5ec954ffcc281f1c9e9c1dc6c4925eff711f0a6d8e14d284/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d44656275675072696e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/FlorianWolters/PHP-Component-Core-DebugPrint/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/6d98803cb9f1b34fb63a2f02249b54c3be4d7ed941b823de62f690fd664b38e6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d44656275675072696e742f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/FlorianWolters/PHP-Component-Core-DebugPrint/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/ef8f5373edb3e495eb7a6cebb295163c9679d1d9f758d82cd35810b9d216211f/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39653161633261642d313262632d343361302d383839322d3833353530666239613738662f6d696e692e706e67)](https://insight.sensiolabs.com/projects/9e1ac2ad-12bc-43a0-8892-83550fb9a78f)[![Coverage Status](https://camo.githubusercontent.com/82b41ab7f91db8ec2c535aed188fe6a2395af27c21fdece7692035f6bfa2e9c3/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d44656275675072696e742e737667)](https://coveralls.io/r/FlorianWolters/PHP-Component-Core-DebugPrint?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/9bc1b90664f57d14639f43fb34ef7cdc7e7631693c2c8c7dbdfee0c83db5a40c/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f762f737461626c652e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)[![Total Downloads](https://camo.githubusercontent.com/393c3d53335f7e358e30711dd1e97376b41c10ad750f7f59f75e3c0a7de48cb1/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f646f776e6c6f6164732e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)[![Monthly Downloads](https://camo.githubusercontent.com/738c5e956bde31afd6785abd3e0249d2089ab7e26a673f129ff990a7324316f1/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f642f6d6f6e74686c792e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)[![Daily Downloads](https://camo.githubusercontent.com/872f788294b1f7d94981b90bdb83b65fe1cf3cb1b57e91fa8a2b0a9042351b26/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f642f6461696c792e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)[![Latest Unstable Version](https://camo.githubusercontent.com/7b2c01b21a491d497c5c0321c20ea3521c8625507c9c2bd5a3cf4628f0ffb1e3/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f762f756e737461626c652e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)[![License](https://camo.githubusercontent.com/60e8744e47d6db2642694d22f338ac7e2ebf6538e0a775b96ab6e637ba5b2a24/68747470733a2f2f706f7365722e707567782e6f72672f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742f6c6963656e73652e706e67)](https://packagist.org/packages/florianwolters/component-core-debugprint)

[![Stories in Ready](https://camo.githubusercontent.com/ac9e20a2308939e3b33ab0880e631d5cd3f029175e321f8e0dac586c3e3a6509/68747470733a2f2f62616467652e776166666c652e696f2f666c6f7269616e776f6c746572732f7068702d636f6d706f6e656e742d636f72652d64656275677072696e742e706e673f6c6162656c3d7265616479267469746c653d5265616479)](https://waffle.io/florianwolters/php-component-core-debugprint)[![Dependency Status](https://camo.githubusercontent.com/4ace99abd2894f0f7399daf7b70981457807c35c2f0bb561ef31d6a1712e1622/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3531633333306638353836326334303030323030303533652f62616467652e737667)](https://www.versioneye.com/user/projects/51c330f85862c4000200053e)[![Dependencies Status](https://camo.githubusercontent.com/f80936c8d8dc271ffbf8474e5e8ef06ee960d05a78045fdf51788b15fb3e557c/68747470733a2f2f646570656e64696e672e696e2f466c6f7269616e576f6c746572732f5048502d436f6d706f6e656e742d436f72652d44656275675072696e742e706e67)](http://depending.in/FlorianWolters/PHP-Component-Core-DebugPrint)[![HHVM Status](https://camo.githubusercontent.com/1331b5ac27412b7f63394450992c1dbc6a6ab74c9549c2cd4dcd95f8ab3e1a55/687474703a2f2f6868766d2e683463632e64652f62616467652f666c6f7269616e776f6c746572732f636f6d706f6e656e742d636f72652d64656275677072696e742e706e67)](http://hhvm.h4cc.de/package/florianwolters/component-core-debugprint)

Table of Contents (ToC)
-----------------------

[](#table-of-contents-toc)

- [Introduction](#introduction)
- [Features](#features)
- [Requirements](#requirements)
- [Usage](#usage)
- [Installation](#installation)
- [Testing](#testing)
- [Contributing](#contributing)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

This component is inspired by the method [`java.lang.Object.toString`](http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#toString() "Object (Java Platform SE 7)") of the [Java](http://java.com "Java") programming language.

**Component\\Core\\DebugPrint** consists of two artifacts:

1. The interface [`FlorianWolters\Component\Core\DebugPrintInterface`](src/main/php/DebugPrintInterface.php "FlorianWolters\Component\Core\DebugPrintInterface"): Indicates that an implementing class provides a *Debug Print Method* for objects.
2. The trait [`FlorianWolters\Component\Core\DebugPrintTrait`](src/main/php/DebugPrintTrait.php "FlorianWolters\Component\Core\DebugPrintTrait"): Provides a default *Debug Print Method* implementation for objects.

Features
--------

[](#features)

- Offers a default hash code value implementation for objects via the method `toString` of the trait [`FlorianWolters\Component\Core\DebugPrintTrait`](src/main/php/DebugPrintTrait.php "FlorianWolters\Component\Core\DebugPrintTrait"). Refer to the section [Usage](#using-the-default-implementation) below for an example.
- Allows to create a custom hash code value implementation by implementing the interface [`FlorianWolters\Component\Core\DebugPrintInterface`](src/main/php/DebugPrintInterface.php "FlorianWolters\Component\Core\DebugPrintInterface"), more precisely implementing the public method `toString` of that interface. Refer to the section [Usage](#using-a-custom-implementation) below for an example.
- Artifacts tested with both static and dynamic test procedures:
    - Dynamic component tests (unit and integration tests) implemented with [PHPUnit](https://phpunit.de "PHPUnit").
    - Static code analysis performed using the following tools:
        - [PHP\_CodeSniffer](https://pear.php.net/package/PHP_CodeSniffer "PHP_CodeSniffer"): Style Checker
        - [PHP Mess Detector (PHPMD)](http://phpmd.org "PHPMD - PHP Mess Detector"): Code Analyzer
        - [PHP Depend](http://pdepend.org "PHP Depend - Software Metrics for PHP"): Code Metrics
        - [phpcpd](https://github.com/sebastianbergmann/phpcpd "sebastianbergmann/phpcpd · GitHub"): Copy/Paste Detector (CPD)
        - [phpdcd](https://github.com/sebastianbergmann/phpdcd "sebastianbergmann/phpdcd · GitHub"): Dead Code Detector (DCD)
        - [SensioLabs Security Checker](https://github.com/sensiolabs/security-checker "SensioLabs Security Checker"): Security Checker
    - Continuous Integration (CI) using the following web services:
        - [Scrutinizer CI](https://scrutinizer-ci.com "Scrutinizer CI")
        - [SensioLabsInsight](https://insight.sensiolabs.com "SensioLabsInsight")
        - [Coveralls](https://coveralls.io "Coveralls")
        - [VersionEye](https://versioneye.com "VersionEye")
        - [Depending](https://depending.in "Depending")
        - [Waffle](https://waffle.io "Waffle")
- Provides a [Packagist](https://packagist.org "Packagist") package which can be installed using the dependency manager [Composer](https://getcomposer.org "Composer"). Click [here](https://packagist.org/packages/florianwolters/component-core-debugprint "florianwolters/component-core-debugprint - Packagist") for the package on [Packagist](https://packagist.org "Packagist").
- Provides a complete Application Programming Interface (API) documentation generated with the documentation generator [Sami](https://github.com/fabpot/sami "fabpot/sami · GitHub"). Click [here](http://blog.florianwolters.de/PHP-Component-Core-DebugPrint "Application Programming Interface (API) documentation") for the API documentation.
- Follows the following "standards" from the [PHP Framework Interoperability Group (FIG)](http://php-fig.org "PHP-FIG — PHP Framework Interop Group"). PSR stands for PHP Standards Recommendation:
    - [PSR-0](http://php-fig.org/psr/psr-0 "PSR-0 requirements for autoloader interoperability"): Autoloading Standards

        > Aims to provide a standard file, class and namespace convention to allow plug-and-play code.
    - [PSR-1](http://php-fig.org/psr/psr-1 "PSR-1 basic coding style guide"): Basic Coding Standard

        > Aims to ensure a high level of technical interoperability between shared PHP code.
    - [PSR-2](http://php-fig.org/psr/psr-2 "PSR-2 coding style guide"): Coding Style Guide

        > Provides a Coding Style Guide for projects looking to standardize their code.
    - [PSR-4](http://php-fig.org/psr/psr-4 "PSR-4: Improved Autoloading"): Autoloader

        > A more modern take on autoloading reflecting advances in the ecosystem.
- Follows the [Semantic Versioning](http://semver.org "Semantic Versioning") (SemVer) specification version 2.0.0.

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

[](#requirements)

### Production

[](#production)

- [PHP](https://php.net "PHP: Hypertext Preprocessor") &gt;= 5.4
- [Composer](https://getcomposer.org "Composer")

### Development

[](#development)

- [PHPUnit](https://phpunit.de "PHPUnit")
- [phpcpd](https://github.com/sebastianbergmann/phpcpd "sebastianbergmann/phpcpd · GitHub")
- [phpdcd](https://github.com/sebastianbergmann/phpdcd "sebastianbergmann/phpdcd · GitHub")
- [PHP\_CodeSniffer](https://pear.php.net/package/PHP_CodeSniffer "PHP_CodeSniffer")
- [PHP Mess Detector (PHPMD)](http://phpmd.org "PHPMD - PHP Mess Detector")
- [Sami](https://github.com/fabpot/sami "fabpot/sami · GitHub")
- [SensioLabs Security Checker](https://github.com/sensiolabs/security-checker "SensioLabs Security Checker")
- [php-coveralls](https://github.com/satooshi/php-coveralls "satooshi/php-coveralls · GitHub")

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

[](#installation)

**Component\\Core\\DebugPrint** should be installed using the dependency manager [Composer](https://getcomposer.org "Composer").

> [Composer](https://getcomposer.org "Composer") is a tool for dependency management in [PHP](https://php.net "PHP: Hypertext Preprocessor"). It allows you to declare the dependent libraries your project needs and it will install them in your project for you.

The [Composer](https://getcomposer.org "Composer") installer can be downloaded with `php`.

```
php -r "readfile('https://getcomposer.org/installer');" | php

```

> This will just check a few [PHP](https://php.net "PHP: Hypertext Preprocessor") settings and then download `composer.phar`to your working directory. This file is the [Composer](https://getcomposer.org "Composer") binary. It is a PHAR ([PHP](https://php.net "PHP: Hypertext Preprocessor") archive), which is an archive format for [PHP](https://php.net "PHP: Hypertext Preprocessor") which can be run on the command line, amongst other things.

> To resolve and download dependencies, run the `install` command:

```
php composer.phar install

```

If you are creating a component that relies on **Component\\Core\\DebugPrint**, please make sure that you add **Component\\Core\\DebugPrint** to your component's `composer.json` file:

```
{
    "require": {
        "florianwolters/component-core-debugprint": "0.3.*"
    }
}
```

Usage
-----

[](#usage)

The best documentation for **\\Component\\Core\\DebugPrint** are the unit tests, which are shipped in the package.

The most important usage rule:

> Always implement the interface [`DebugPrintInterface`](src/main/php/DebugPrintInterface.php "FlorianWolters\Component\Core\DebugPrintInterface") if using the trait [`DebugPrintTrait`](src/main/php/DebugPrintTrait.php "FlorianWolters\Component\Core\DebugPrintTrait"), since that allows [Type Hinting](https://php.net/language.oop5.typehinting "PHP: Type Hinting - Manual").

The class [`DebugPrintExample`](resources/php/DebugPrintExample.php "FlorianWolters\Example\DebugPrintExample") can be run via the command `php resources/php/DebugPrintExample.php` from the root of the project.

### Default *Debug Print Method*

[](#default-debug-print-method)

The class [`DebugPrintDefaultImpl`](src/test/resources/DebugPrintDefaultImpl.php "FlorianWolters\Example\DebugPrintDefaultImpl.php") uses the default implementation of the trait [`DebugPrintTrait`](src/main/php/DebugPrintTrait.php "FlorianWolters\Component\Core\DebugPrintTrait").

### Custom *Debug Print Method*

[](#custom-debug-print-method)

The class [`DebugPrintCustomImpl`](src/test/resources/DebugPrintCustomImpl.php "FlorianWolters\Example\DebugPrintCustomImpl.php") implements a custom implementation, which fulfills the design contract for a *Value Object*.

Testing
-------

[](#testing)

```
phpunit

```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Florian Wolters](https://github.com/FlorianWolters "FlorianWolters · GitHub")
- [All Contributors](https://github.com/FlorianWolters/PHP-Component-Core-DebugPrint/contributors "Contributors to FlorianWolters/PHP-Component-Core-DebugPrint")

License
-------

[](#license)

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see .

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity50

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

Total

3

Last Release

4333d ago

PHP version history (2 changes)v0.1.0-betaPHP &gt;=5.3.0

v0.2.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/75dd7e42d69a87c4a0c68b4f29f5d223eb1f9a3f647abafa72da80d2a06d2442?d=identicon)[FlorianWolters](/maintainers/FlorianWolters)

---

Top Contributors

[![FlorianWolters](https://avatars.githubusercontent.com/u/1318837?v=4)](https://github.com/FlorianWolters "FlorianWolters (32 commits)")

---

Tags

languagedebugcorepattern\_\_toStringdebug print method

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/florianwolters-component-core-debugprint/health.svg)

```
[![Health](https://phpackages.com/badges/florianwolters-component-core-debugprint/health.svg)](https://phpackages.com/packages/florianwolters-component-core-debugprint)
```

###  Alternatives

[symfony/var-dumper

Provides mechanisms for walking through any arbitrary PHP variable

7.4k855.5M8.0k](/packages/symfony-var-dumper)[barryvdh/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k124.3M624](/packages/barryvdh-laravel-debugbar)[php-debugbar/php-debugbar

Debug bar in the browser for php application

4.4k21.3M40](/packages/php-debugbar-php-debugbar)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k29](/packages/fruitcake-laravel-debugbar)[kint-php/kint

Kint - Advanced PHP dumper

2.8k19.3M283](/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.8k24.4M1.3k](/packages/tracy-tracy)

PHPackages © 2026

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