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
- Host: GitHub
- URL: https://github.com/kuria/debug
- Owner: kuria
- License: mit
- Created: 2017-05-22T16:36:40.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-01-05T21:14:53.000Z (over 1 year ago)
- Last Synced: 2025-03-26T21:37:40.648Z (about 1 year ago)
- Topics: debug, dump, error, exception, hex, php
- Language: PHP
- Homepage:
- Size: 39.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE
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