Download the PHP package donquixote/nicetrace without Composer
On this page you can find all versions of the php package donquixote/nicetrace. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donquixote/nicetrace
More information about donquixote/nicetrace
Files in donquixote/nicetrace
Package nicetrace
Short Description Library to make human-friendly PHP backtrace arrays.
License MIT
Homepage http://github.com/donquixote/nicetrace
Informations about the package nicetrace
nicetrace
PHP library to generate a human-friendly backtrace array.
Inspired from ddebug_backtrace() in the Devel module for Drupal.
The structure of the nicetrace can be seen in nicetrace.php
Development status
This library is quite fresh, and I am still ironing out API details, that is, names of interfaces, method signatures, etc.
You are welcome to participate.
Features
The main design goal is a backtrace array structure that looks nice in recursive array display tools, such as Krumo, or possibly Ladybug.
- Indices of trace items enhanced with function / method names.
- Indices for arguments enhanced with parameter names (based on reflection).
- Indices of trace items reversed, so that the index reflects the depth in the call tree.
- Arguments inlined, so the array becomes flatter. E.g.
$backtrace[5]['args'][0] = ..
becomes
$nicetrace[' 8: foo()']['args[0]: $x'] = ..
. - Filename and line number from trace item one level deeper, instead of the "called from".
- File paths shortened, if known base paths are specified.
- File basename and line number combined into one array key. E.g.
$backtrace[5]['file'] = '/../src/MyNamespace/MyFile.php'; $backtrace[5]['line'] = 97;
becomes
$nicetrace[' 8: foo()']['MyClass.php: 97'] = 'src/MyNamespace/MyClass.php';
Basic usage
Advanced usage
The library allows to create and compose custom BacktraceToNicetrace handlers.
It is recommended to use the fluent interface provided by the Builder class.
The test case gives some examples.