decodelabs / remnant
Easier stack traces
v0.1.0
2025-06-04 12:29 UTC
Requires
- php: ^8.4
Requires (Dev)
- decodelabs/monarch: ^0.1.3
- decodelabs/phpstan-decodelabs: ^0.7.0
Conflicts
- decodelabs/monarch: <0.1.3
This package is auto-updated.
Last update: 2025-06-04 12:30:23 UTC
README
Easier stack traces
Remnant provides a simple way to generate more user-friendly stack traces in PHP.
Installation
Install via Composer:
composer require decodelabs/remnant
Usage
Create a trace in the current context or from an Exception:
use DecodeLabs\Remnant\Trace; $trace = Trace::create(); $exceptionTrace = Trace::fromException($exception); // Pass an integer to either method to rewind the trace by that many frames $trace = Trace::create(2); $exceptionTrace = Trace::fromException($exception, 2);
Access frames from the trace using standard array methods:
foreach ($trace as $frame) { echo $frame->file . ':' . $frame->line . ' - ' . $frame->function . PHP_EOL; } $frame = $trace[0]; // Get the first frame echo (string)$frame; // Convert frame to string for a formatted output
Licensing
Remnant is licensed under the MIT License. See LICENSE for the full license text.