PHP code example of femastudios / jtrace

1. Go to this page and download the library: Download femastudios/jtrace 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/ */

    

femastudios / jtrace example snippets


// Create a JTrace class
$jtrace = JTrace::new();
// $e is a \Throwable instance
$jtrace->fromThrowable($e); // Returns the stacktrace as a string
$jtrace->printFromThrowable($e); // Prints the stacktrace

JTrace::new()
    ->) // Removes the items limit
    ->maxCauses(8); // Limits the number of chained exceptions to 8

LogicException (0): Inner threw
    at C:\Users\username\Desktop\php\jtrace\tests\Code.php:16
    at C:\Users\username\Desktop\php\jtrace\tests\test.php:14->run()
    at C:\Users\username\Desktop\php\jtrace\tests\test.php:18

Caused by:
Exception (101): Inner message
    at C:\Users\username\Desktop\php\jtrace\tests\Code.php:9
    at C:\Users\username\Desktop\php\jtrace\tests\Code.php:14->runInner()
    at C:\Users\username\Desktop\php\jtrace\tests\test.php:14->run()
    at C:\Users\username\Desktop\php\jtrace\tests\test.php:18