# Trace

# Summary

Tooling for handling debug_backtrace (opens new window) items.

# Installing

Trace is available through Packagist (opens new window) and the repository source is at chevere/trace (opens new window).

composer require chevere/trace

# Creating a Trace

Create a Trace by passing a PHP debug_backtrace array and a format object.

use Chevere\Trace\Formats\PlainFormat;
use Chevere\Trace\Trace;

$debugBacktrace = debug_backtrace();
$format = new PlainFormat();
$trace = new Trace($debugBacktrace, $format);

# To Array

Use method toArray to get an array representation of the formatted trace.

$array = $trace->toArray();

# To String

Use method __toString to get a string representation of the formatted trace.

$string = $trace->__toString();

# Table

Use method table to get the array used to translate template keys to values.

$table = $trace->table();