PHPackages                             loilo/traceback - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. loilo/traceback

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

loilo/traceback
===============

Get the file or directory calling your code

1.0.0(6y ago)04822MITPHPPHP &gt;= 7.1

Since Jul 16Pushed 5y agoCompare

[ Source](https://github.com/loilo/traceback)[ Packagist](https://packagist.org/packages/loilo/traceback)[ RSS](/packages/loilo-traceback/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (2)Used By (2)

 [![Traceback logo: two dog footprints next to each other](traceback.svg)](traceback.svg)

Traceback
=========

[](#traceback)

[![Tests](https://camo.githubusercontent.com/a1a5fc166b98f5713510370a7872171f99bfad69bcebd554e5960cf9692de3a5/68747470733a2f2f62616467656e2e6e65742f6769746875622f636865636b732f6c6f696c6f2f74726163656261636b2f6d6173746572)](https://github.com/loilo/traceback/actions)[![Version on packagist.org](https://camo.githubusercontent.com/94fa87f38afda63270b4f5a8a766136567d64ad3011f4a4567548a074553d0c3/68747470733a2f2f62616467656e2e6e65742f7061636b61676973742f762f6c6f696c6f2f74726163656261636b)](https://packagist.org/packages/loilo/traceback)

Get the file or directory calling your code.

Installation
------------

[](#installation)

```
composer require loilo/traceback
```

Usage
-----

[](#usage)

`/var/www/foo.php`

```
require_once __DIR__ . '/vendor/autoload.php';

use Loilo\Traceback\Traceback;

function foo()
{
    var_dump(
        // File path calling foo()
        Traceback::file(),

        // Directory of file calling foo()
        Traceback::dir(),

        // File path calling foo() but skipping
        // the first file in the chain
        Traceback::file(1),

        // Directory of file calling foo() with skipping
        Traceback::dir(1)
    );
}
```

`/var/www/bar.php`

```
require_once __DIR__ . '/foo.php';

foo();
```

`/var/www/baz/qux.php`

```
require_once __DIR__ . '/../bar.php';
```

Running `qux.php` will output:

```
string(16) "/var/www/bar.php"
string(8) "/var/www"
string(20) "/var/www/baz/qux.php"
string(12) "/var/www/baz"

```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2533d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b1da49bad9203cc40a34d975dc00c80af09452bee1da6413e2f1b8214b539675?d=identicon)[loilo](/maintainers/loilo)

---

Top Contributors

[![loilo](https://avatars.githubusercontent.com/u/1922624?v=4)](https://github.com/loilo "loilo (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/loilo-traceback/health.svg)

```
[![Health](https://phpackages.com/badges/loilo-traceback/health.svg)](https://phpackages.com/packages/loilo-traceback)
```

###  Alternatives

[spatie/laravel-google-fonts

Manage self-hosted Google Fonts in Laravel apps

4911.1M16](/packages/spatie-laravel-google-fonts)[rareloop/hatchet

1042.8k](/packages/rareloop-hatchet)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
