PHPackages                             techrays-labs/laravel-debt-tracker - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. techrays-labs/laravel-debt-tracker

ActiveLibrary[Testing &amp; Quality](/categories/testing)

techrays-labs/laravel-debt-tracker
==================================

Scan, score, and report technical debt in your Laravel application.

v1.3.0(3w ago)1257↑260%1MITPHPPHP ^8.2CI passing

Since Jun 3Pushed 3w agoCompare

[ Source](https://github.com/techrays-labs/laravel-debt-tracker)[ Packagist](https://packagist.org/packages/techrays-labs/laravel-debt-tracker)[ RSS](/packages/techrays-labs-laravel-debt-tracker/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (25)Versions (11)Used By (0)

 [![Laravel Debt Tracker](art/logo.png)](art/logo.png)

Laravel Debt Tracker
====================

[](#laravel-debt-tracker)

 [ ![Built by Techrays Labs](https://camo.githubusercontent.com/a0e662110ccb877504e8f58cac80e5d46b42517b74b3f3b3e24d82fd227a3640/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c7425323062792d54656368726179732532304c6162732d3030353746463f7374796c653d666f722d7468652d6261646765) ](https://techrayslabs.com) [ ![Latest Stable Version](https://camo.githubusercontent.com/2e5d0c3bb7984b3722c4cea3c2b47cc5dbeda3eb38ca8d8243e9d2afedac901d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656368726179732d6c6162732f6c61726176656c2d646562742d747261636b65723f7374796c653d666f722d7468652d6261646765266c6162656c3d737461626c65) ](https://packagist.org/packages/techrays-labs/laravel-debt-tracker) [ ![Total Downloads](https://camo.githubusercontent.com/370fb6fb89a8792a5d9e508d469cb1d8f19dd727af7c7045e5b64ba0e8095288/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656368726179732d6c6162732f6c61726176656c2d646562742d747261636b65723f7374796c653d666f722d7468652d6261646765) ](https://packagist.org/packages/techrays-labs/laravel-debt-tracker) [![PHP Version](https://camo.githubusercontent.com/8c751af124bc4fa1ec022d8776d63411c93e8d722abc402bd74049512f414f1e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e32253230253743253230382e33253230253743253230382e342d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/8c751af124bc4fa1ec022d8776d63411c93e8d722abc402bd74049512f414f1e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e32253230253743253230382e33253230253743253230382e342d3737374242343f7374796c653d666f722d7468652d6261646765266c6f676f3d706870266c6f676f436f6c6f723d7768697465) [![Laravel Version](https://camo.githubusercontent.com/1a1623d9cb3822055a983858c4bfbd345d6a36d5d428eb63558a56dcce7bc764/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/1a1623d9cb3822055a983858c4bfbd345d6a36d5d428eb63558a56dcce7bc764/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) [ ![Pulse Cards Included](https://camo.githubusercontent.com/a0abbb071d0defe23df499b9f554945d7df911dac8255ea41286adb1ddc051ef/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50756c73652d4361726473253230496e636c756465642d4646324432303f7374796c653d666f722d7468652d6261646765266c6f676f3d6c61726176656c266c6f676f436f6c6f723d7768697465) ](https://laravel.com/docs/pulse) [ ![License](https://camo.githubusercontent.com/9091889a9fd88bb20c26fd4b4b9bce11e95eb240ef075a304fa0149e35efd6a6/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f74656368726179732d6c6162732f6c61726176656c2d646562742d747261636b65723f7374796c653d666f722d7468652d6261646765) ](https://github.com/techrays-labs/laravel-debt-tracker/blob/master/LICENSE)

 **Scan, score, and report technical debt in your Laravel application — right from the CLI.**

---

> **"We should fix this eventually"** — every engineering team, forever.
>
> Laravel Debt Tracker makes the invisible visible. It scans your codebase for technical debt across nine detectors, assigns a score, estimates developer hours to resolve, and produces a Markdown or JSON report you can actually show your product manager.

---

Features
--------

[](#features)

- **TODO / FIXME detection** — finds every deferred problem in your comments
- **Complexity analysis** — cyclomatic complexity, long methods, God classes, deep nesting
- **N+1 query detection** — flags Eloquent lazy-load patterns inside loops and collection iterators
- **Security smell detection** — flags eval/exec, hardcoded credentials, md5/sha1 on passwords, SQL concatenation, unsafe unserialize, and debug leakage
- **Dead code detection** — flags unused private methods, properties, and constants within classes
- **Test coverage heuristics** — no Xdebug required; detects untested classes and methods
- **Dependency audit** — flags outdated or abandoned Composer packages
- **Git blame enrichment** — older debt scores higher; age is the multiplier
- **Git author leaderboard** — surfaces who owns the most debt across terminal, Markdown, and JSON reports
- **Laravel Pulse cards** — grade summary, score trend, hottest files, and author leaderboard visible in your Pulse dashboard with zero extra packages
- **Debt grading** — A through F, with estimated dev hours to resolve
- **Markdown &amp; JSON export** — shareable reports with a shield badge for your README

---

Requirements
------------

[](#requirements)

RequirementVersionPHP8.2, 8.3, 8.4Laravel10, 11, 12, 13---

> **Support policy:** Only the current release (`v1.3.x`) receives bug fixes, security patches, and updates. All versions below v1.3 have reached end of life. If you are on v1.0, v1.1, or v1.2 please upgrade — see [CHANGELOG.md](CHANGELOG.md) for what changed.

---

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

[](#installation)

```
composer require --dev techrays-labs/laravel-debt-tracker
```

That's it. The package auto-discovers itself.

Optionally publish the config:

```
php artisan vendor:publish --tag=debt-tracker-config
```

---

Usage
-----

[](#usage)

### Full scan

[](#full-scan)

```
php artisan debt:scan
```

```
┌ Laravel Debt Tracker · by Techrays Labs ──────────────────┐

  Scanning files  ████████████████░░░░  249/312
  app/Services/LegacyPaymentService.php

  Project Grade: C    Total Score: 412    Est. Hours: 103h

  Debt by Category:
  ┌─────────────────────────┬───────┬──────────┐
  │ Category                │ Items │ Score    │
  ├─────────────────────────┼───────┼──────────┤
  │ TODOs / FIXMEs          │  ---  │  112     │
  │ Complexity              │  ---  │  180     │
  │ Missing Test Coverage   │  ---  │   88     │
  │ Outdated Dependencies   │  ---  │   32     │
  │ N+1 Queries             │  ---  │   24     │
  │ Security Smells         │  ---  │   18     │
  │ Dead Code               │  ---  │    6     │
  └─────────────────────────┴───────┴──────────┘

  Top 10 Worst Files:
  ┌────────────────────────────────────────┬───────┬───────┐
  │ File                                   │ Items │ Score │
  ├────────────────────────────────────────┼───────┼───────┤
  │ app/Services/LegacyPaymentService.php  │  14   │  98   │
  │ app/Http/Controllers/OrderController   │   9   │  72   │
  │ ...                                    │       │       │
  └────────────────────────────────────────┴───────┴───────┘

└ Scan complete · Grade: C · Score: 412 · 47 items found ───┘

```

### Export to Markdown

[](#export-to-markdown)

```
php artisan debt:scan --export=markdown
```

Writes `DEBT_REPORT.md` to your project root — ready to commit or share.

### Export to JSON

[](#export-to-json)

```
php artisan debt:scan --export=json
```

Writes `DEBT_REPORT.json` — machine-readable output for dashboards, scripts, or CI integrations.

### Export both at once

[](#export-both-at-once)

```
php artisan debt:scan --export=markdown,json
```

### CI-friendly summary

[](#ci-friendly-summary)

```
php artisan debt:summary
# [Techrays Debt Tracker] Grade: C | Score: 412 | Est: 103h | Files: 312
# Exit code: 1 (C), 0 (A/B), 2 (D/F) — gate your pipeline on debt grade
```

### Scan a specific path

[](#scan-a-specific-path)

```
php artisan debt:scan --path=app/Services
```

### Run specific detectors only

[](#run-specific-detectors-only)

Every detector has a key you can pass to `--only`. Combine as many as you need with commas.

```
# TODOs, FIXMEs, HACKs, XXXs, TEMPs and REFACTORs in comments
php artisan debt:scan --only=todos

# Cyclomatic complexity, long methods, God classes, deep nesting
php artisan debt:scan --only=complexity

# Missing test files and untested public methods
php artisan debt:scan --only=coverage

# Outdated or abandoned Composer packages
php artisan debt:scan --only=dependencies

# Eloquent lazy-load (N+1) patterns inside loops and collection iterators
php artisan debt:scan --only=n1_queries

# Security smells: eval/exec, hardcoded credentials, weak hashing,
# SQL concatenation, unsafe unserialize, debug leakage (dd/dump)
php artisan debt:scan --only=security

# Dead code: unused private methods, properties and constants
php artisan debt:scan --only=dead_code

# Combine any detectors in a single run
php artisan debt:scan --only=security,dead_code
php artisan debt:scan --only=todos,complexity,n1_queries
php artisan debt:scan --only=todos,complexity,coverage,dependencies,n1_queries,security,dead_code
```

> **Note:** `--only` works at the detector level. For example, `--only=dead_code` reports unused private methods, properties, and constants together — there is no sub-filter within a detector.

### Inspect a single file or class

[](#inspect-a-single-file-or-class)

```
php artisan debt:show-file app/Services/PaymentService.php
php artisan debt:show-class "App\Services\PaymentService"
```

---

Configuration
-------------

[](#configuration)

```
// config/debt-tracker.php

return [
    'scan_paths' => ['app'],
    'exclude_paths' => ['app/Http/Middleware'],

    'thresholds' => [
        'method_length'        => 30,   // lines
        'class_length'         => 500,  // lines
        'max_public_methods'   => 20,
        'nesting_depth'        => 4,
        'complexity_per_method'=> 10,
    ],

    'cost' => [
        'hours_per_point' => 0.25,
        'hourly_rate'     => null, // set to show $ estimates
    ],

    'detectors' => [
        'todos'        => true,
        'complexity'   => true,
        'coverage'     => true,
        'dependencies' => true,
        'git_age'      => true,
        'n1_queries'   => true,
        'security'     => true,
        'dead_code'    => true,
    ],

    'n1_ignore_properties'     => ['id', 'uuid', 'created_at', 'updated_at', 'deleted_at'],
    'security_exclude_paths'   => ['tests', 'database/seeders'],
    'dead_code_ignore_methods' => [],

    'export' => [
        'path'      => base_path('DEBT_REPORT.md'),
        'json_path' => base_path('DEBT_REPORT.json'),
    ],
];
```

---

Laravel Pulse Integration
-------------------------

[](#laravel-pulse-integration)

Laravel Debt Tracker ships with four built-in Pulse dashboard cards. No extra package needed — the cards activate automatically when `laravel/pulse` and `livewire/livewire` are present in your app.

> **Requirements**
>
> - `laravel/pulse ^1.0` — tested with v1.0 through v1.7
> - `livewire/livewire ^3.0` — pulled in automatically as a dependency of Pulse
> - **MySQL 8 or MariaDB** — MySQL 9 is not currently supported due to a bug in Pulse's `DatabaseStorage` where `key_hash` is omitted from INSERTs on MySQL 9, causing a strict-mode constraint failure. Track progress at [laravel/pulse#476](https://github.com/laravel/pulse/issues/476) (or check the Pulse changelog for a fix).
>
> Neither package is a hard dependency of `laravel-debt-tracker`. Install them in your app and the integration activates on its own.

CardComponent tagWhat it shows**Debt Summary**``Current grade (A–F), total score, estimated hours, category breakdown**Score Over Time**``Debt score trend chart — see when PRs made things worse**Hottest Files**``Top 10 files by debt score, updated every scan**Top Debt Authors**``Top 10 authors by total debt score via git blame### Setup

[](#setup)

**1. Publish the card views** (optional — only needed to customise them):

```
php artisan vendor:publish --tag=debt-tracker-pulse-views
```

**2. Add the cards to your Pulse dashboard** in `resources/views/vendor/pulse/dashboard.blade.php`:

```

```

> The `cols` values above fill a standard 12-column Pulse grid row. Adjust to your layout.

**3. Populate the cards** — run a scan:

```
php artisan debt:scan
```

Cards update automatically every time `debt:scan` runs.

### Scheduled scans

[](#scheduled-scans)

To keep your dashboard up to date automatically, schedule `debt:scan` in `routes/console.php`:

```
use Illuminate\Support\Facades\Schedule;

Schedule::command('debt:scan')->daily();
```

### Disabling Pulse push

[](#disabling-pulse-push)

To run ad-hoc scans without updating the dashboard, set in `config/debt-tracker.php`:

```
'pulse' => [
    'enabled' => false,
],
```

---

How Scoring Works
-----------------

[](#how-scoring-works)

Each detected debt item gets a **base score** multiplied by an **age multiplier**:

```
Item Score = Base Weight × Age Multiplier

```

Debt TypeBase ScoreTODO / FIXME2Long method5God class15Deep nesting4Untested class8Outdated major dep10Abandoned package20N+1 property fetch6N+1 chained query10Dangerous function call (eval/exec)20Unsafe unserialize20Hardcoded credential15SQL concatenation15Weak hashing (md5/sha1)10Debug leakage (dd/dump)5Unused private method8Unused private property5Unused private constant3Debt AgeMultiplier&lt; 30 days1.0×30–90 days1.5×90–180 days2.0×180+ days3.0×Total ScoreGrade0–100A — Healthy101–300B — Manageable301–600C — Concerning601–1000D — Critical1000+F — Emergency---

Reports
-------

[](#reports)

### Markdown

[](#markdown)

The exported `DEBT_REPORT.md` includes a shields.io badge you can embed in your README:

```
![Debt Grade](https://img.shields.io/badge/Debt%20Grade-C-yellow)
```

### JSON

[](#json)

`DEBT_REPORT.json` uses a stable schema suitable for CI dashboards or custom tooling:

```
{
  "generated_at": "2026-06-09T19:49:00+00:00",
  "grade": "B",
  "total_score": 141,
  "estimated_hours": 35.3,
  "file_count": 18,
  "item_count": 21,
  "by_category": [...],
  "authors": [{"author": "Jane Doe", "debt_score": 87}, ...],
  "top_files": [...],
  "top_classes": [...],
  "items": [...],
  "meta": { "package": "techrays-labs/laravel-debt-tracker", "url": "..." }
}
```

---

Contributing
------------

[](#contributing)

Contributions are welcome!

- Read [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, coding standards, and how to add a new detector
- Read [CODE\_OF\_CONDUCT.md](CODE_OF_CONDUCT.md) before participating in discussions or submitting contributions
- Report security vulnerabilities privately via [SECURITY.md](SECURITY.md) — do not open a public issue
- Use the [Bug Report](https://github.com/techrays-labs/laravel-debt-tracker/issues/new?template=bug_report.md) or [Feature Request](https://github.com/techrays-labs/laravel-debt-tracker/issues/new?template=feature_request.md) issue templates

```
git clone https://github.com/techrays-labs/laravel-debt-tracker
cd laravel-debt-tracker
composer install
php vendor/bin/testbench package:test
```

---

License
-------

[](#license)

MIT · © [Techrays Labs](https://techrayslabs.com)

---

 Built with ❤️ by [**Techrays Labs**](https://techrayslabs.com) · Ahmedabad, India
 We build software and the teams that build software.

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance95

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Every ~3 days

Total

10

Last Release

22d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbc81921c8cd498bd1d838e44ad7cad57b73e08cdfefa576289e9afe4cb88273?d=identicon)[techrays-labs](/maintainers/techrays-labs)

---

Top Contributors

[![chirag-techrayslabs](https://avatars.githubusercontent.com/u/160377961?v=4)](https://github.com/chirag-techrayslabs "chirag-techrayslabs (66 commits)")

---

Tags

artisancode-qualitycomposerdeveloper-toolslaravellaravel-packagephptechnical-debt

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/techrays-labs-laravel-debt-tracker/health.svg)

```
[![Health](https://phpackages.com/badges/techrays-labs-laravel-debt-tracker/health.svg)](https://phpackages.com/packages/techrays-labs-laravel-debt-tracker)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M246](/packages/laravel-ai)[livewire/flux

The official UI component library for Livewire.

9577.8M138](/packages/livewire-flux)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[aeliot/todo-registrar

Register TODOs from source code in issue tracker

153.0k](/packages/aeliot-todo-registrar)

PHPackages © 2026

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