PHPackages                             fusionspim/php-capsule-listener - 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. [Database &amp; ORM](/categories/database)
4. /
5. fusionspim/php-capsule-listener

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

fusionspim/php-capsule-listener
===============================

Simple debugging tool for usage with Laravel's Eloquent ORM

7.0.0(4y ago)02.0kMITPHPPHP ^8.0

Since Apr 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/fusionspim/php-capsule-listener)[ Packagist](https://packagist.org/packages/fusionspim/php-capsule-listener)[ RSS](/packages/fusionspim-php-capsule-listener/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (10)Dependencies (6)Versions (29)Used By (0)

PHP Capsule Debug Listener
==========================

[](#php-capsule-debug-listener)

Capsule Debug Listener is a simple debugging tool for usage with [Laravel's Eloquent ORM](https://laravel.com/docs/master/eloquent). It's named "Capsule" after the [standalone version of Eloquent](https://github.com/illuminate/database).

It will dump out what queries are being executed by Eloquent in your code and show where in your codebase they originate from.

Installation:
-------------

[](#installation)

`composer require --dev fusionspim/php-capsule-listener`

Usage
-----

[](#usage)

You can start using it by creating a new instance and enabling listening:

```
$listener = new CapsuleDebugListener;
$listener->enable();
// Run some SQL.
$listener->disable();

```

If you need to start and stop the debugger across files, you can use it as a singleton:

```
CapsuleDebugListener::getInstance()->enable();
// Run some SQL.
CapsuleDebugListener::getInstance()->disable();

```

You can also use it as a multiton by specifying a name. This may be handy for multiple connections:

```
CapsuleDebugListener::getInstance('write')
    ->setConnection(Capsule::connection('write'))
    ->enable();
// Run some SQL.
CapsuleDebugListener::getInstance('write')->disable();

```

There are also some handy helper function pairs. You can dump the trace like this:

```
start_dumping_queries();
// Run some SQL.
stop_dumping_queries();

```

And you can capture a trace like this:

```
start_capturing_queries();
// Run some SQL.
$logs = stop_capturing_queries();
var_dump($logs);

```

By default the output is dumped out using [Symfony's VarDumper](https://symfony.com/doc/current/components/var_dumper.html), but you can also specify your own output handling function when calling `enable()`:

```
(new CapsuleDebugListener)->enable(function (array $stack) {
    // Your custom output handling here.
});

```

A trace array is structured like this:

```
[
    // A running count of how many queries have run.
    'count' => 1,

    // The SQL run with parameters replaced.
    // May contain sensitive data.
    'sql' => 'SELECT * FROM foo',

    // An array that contains a cleaned up stack trace of where the query originated from.
    // Excludes Eloquent's codebase and any magic functions.
    'callees' => [
        'Foo\Bar\Model:do_something in /src/Foo/Bar/Model.php:256',
    ],
]

```

If you need to debug a specific connection, you can specific it via `setConnection()`:

```
$listener = new CapsuleDebugListener();
$listener->setConnection(Capsule::connection('write'));
$listener->enable();
// Run some SQL.
$listener->disable();

```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 64.8% 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 ~61 days

Recently: every ~72 days

Total

25

Last Release

1482d ago

Major Versions

2.4.1 → 3.0.02020-03-24

3.2.0 → 4.0.02020-10-27

4.0.1 → 5.0.02021-03-11

5.0.8 → 6.0.02021-12-21

6.0.0 → 7.0.02022-04-25

PHP version history (7 changes)1.0.0PHP ^7.1

2.1.0PHP ^7.2

3.0.0PHP ^7.3

3.1.2PHP &gt;=7.3

3.2.0PHP &gt;=7.4

5.0.6PHP ^7.4 || ^8.0

6.0.0PHP ^8.0

### Community

Maintainers

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

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

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

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (306 commits)")[![weshooper](https://avatars.githubusercontent.com/u/2248206?v=4)](https://github.com/weshooper "weshooper (111 commits)")[![ziadoz](https://avatars.githubusercontent.com/u/645637?v=4)](https://github.com/ziadoz "ziadoz (41 commits)")[![maxakropolis](https://avatars.githubusercontent.com/u/10739767?v=4)](https://github.com/maxakropolis "maxakropolis (11 commits)")[![liamkeily](https://avatars.githubusercontent.com/u/2040842?v=4)](https://github.com/liamkeily "liamkeily (2 commits)")[![WillJW](https://avatars.githubusercontent.com/u/1878977?v=4)](https://github.com/WillJW "WillJW (1 commits)")

---

Tags

laraveldebugormeloquentcapsule

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fusionspim-php-capsule-listener/health.svg)

```
[![Health](https://phpackages.com/badges/fusionspim-php-capsule-listener/health.svg)](https://phpackages.com/packages/fusionspim-php-capsule-listener)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[pdphilip/elasticsearch

An Elasticsearch implementation of Laravel's Eloquent ORM

145360.2k4](/packages/pdphilip-elasticsearch)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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