PHP code example of decodelabs / remnant

1. Go to this page and download the library: Download decodelabs/remnant library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

decodelabs / remnant example snippets


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);

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