An open API service indexing awesome lists of open source software.

https://github.com/kuria/debug

Collection of useful debugging utilities
https://github.com/kuria/debug

debug dump error exception hex php

Last synced: about 1 year ago
JSON representation

Collection of useful debugging utilities

Awesome Lists containing this project

README

          

Debug utilities
###############

Collection of useful debugging utilities.

.. image:: https://travis-ci.com/kuria/debug.svg?branch=master
:target: https://travis-ci.com/kuria/debug

.. contents::
:depth: 2

Requirements
************

PHP 7.1+

Dumper
******

Utilities for inspecting arbitrary values.

Dumping any value
=================

Dumping arbitrary PHP values with nesting and string length limits.

.. code:: php

"foo bar"
[1] => 123
[2] => -123
[3] => 1.530000
[4] => -1.530000
[5] => true
[6] => false
[7] => resource(stream#10)
[8] => NULL
[9] => array[3]
[10] => object(stdClass)
}

- see other arguments of ``dump()`` for nesting and string limits
- if an object implements the ``__debugInfo()`` method, its output
will be used instead of the properties
- if an object implements the ``__toString()`` method, its output
will be used instead of its properties if:

A. it has no properties
B. the properties cannot be displayed due to the nesting limit

- if an object implements the ``\DateTimeInterface``, its value
will be formatted as a string

Dumping strings
===============

Safely dumping arbitrary strings. All ASCII < 32 will be escaped in C style.

.. code:: php

ReflectionProperty Object
(
[name] => staticProperty
[class] => Foo\Foo
)

[publicProperty] => ReflectionProperty Object
(
[name] => publicProperty
[class] => Foo\Foo
)

[privateProperty] => ReflectionProperty Object
(
[name] => privateProperty
[class] => Foo\Foo
)

)

Output
******

Utilities related to PHP's output system.

Cleaning output buffers
=======================

.. code:: php

getMessage(), "\n";
}
}

Output:

::

Something went wrong
Invalid parameter

Joining exception chains together
=================================

Joining exception chains has some uses in exception-handling code where
additional exception may be thrown.

.. code:: php