Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Backtrace Laravel Package

axy/backtrace

axy/backtrace is a lightweight PHP 8.1+ helper for working with call stacks. It provides Trace and ExceptionTrace utilities to inspect and trim backtraces, useful for debugging and cleaning up exception stack displays in apps and libraries.

View on GitHub
Deep Wiki
Context7

ExceptionTrace: point of exception

The class axy\backtrace\ExceptionTrace extends the class Trace.

An instance of this class, in addition to the stack, also contains a reference to the line where the exception occurred.

__construct([array $items [, string $file, int $line])

  • $items - see Trace
  • $file and $line - the place where the exception occured.

This is the data that can be received using $e->getTrace(), $e->getFile() and $e->getLine().

If no arguments are given, a point of the instance creation will be taken.

/* File /test/index.php */
use axy\backtrace\ExceptionTrace;

function one()
{
    return two();
}

function two()
{
    return new ExceptionTrace(); // line 15
}

$trace = one();

echo 'File: '.$trace->file.\PHP_EOL;
echo 'Line: '.$trace->line.\PHP_EOL;
echo $trace;

The output:

File: /test/index.php
Line: 15
#0 /test/index.php(10): two()
#1 /test/index.php(18): one()
#2 {main}

If you specify $items, but do not specify $file and $line, they are taken from the current call.

Properties (read-only)

Inherited from Trace:

  • $items
  • $originalItems

New:

  • $file
  • $line
  • $originalFile
  • $originalLine

$original* can not be modified. The others can be modified by methods.

truncate*

See Trace::truncate().

In additional, $file and $line are changed to point to the entry point into the library.

trimFilename(string $dir)

In additional, trims the $file.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus