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.
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen
seampact/hooks
seampact/ir
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table