innmind / stack-trace
Tool to inspect exception stack trace
4.2.0
2025-06-07 15:54 UTC
Requires
- php: ~8.2
- innmind/graphviz: ~4.0
- innmind/immutable: ~5.16
- innmind/url: ~4.4
Requires (Dev)
- innmind/black-box: ^6.4.1
- innmind/coding-standard: ~2.0
- innmind/static-analysis: ~1.2.1
This package is auto-updated.
Last update: 2025-06-07 15:57:03 UTC
README
Tool to inspect an Exception stack trace
Installation
composer require innmind/stack-trace
Usage
use Innmind\StackTrace\{ StackTrace, Render, }; use Innmind\OperatingSystem\Factory; use Innmind\Server\Control\Server\Command; $trace = StackTrace::of(new AnyClassImplementingPhpThrowableInterface); // every call frames that lead to the exception to be thrown // (deepest call frame first) $callFrames = $trace->throwable()->callFrames(); // this will render the stack trace via graphviz Factory::build() ->control() ->processes() ->execute( Command::foreground('dot') ->withShortOption('Tsvg') ->withShortOption('o', 'graph.svg') ->withInput( Render::of()($trace) ), ) ->unwrap() ->wait();
Note
The svg rendered contains links to the files where call frames and exceptions occured, you can change the link by providing an instance of Link
to the Render
object.