PHPackages                             cyber-duck/fluent-debug - 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. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. cyber-duck/fluent-debug

Abandoned → [cyber-duck/fluent-debug](/?search=cyber-duck%2Ffluent-debug)Library[Debugging &amp; Profiling](/categories/debugging)

cyber-duck/fluent-debug
=======================

1.0.2(9y ago)27.8k2MITPHP

Since Feb 4Pushed 2y ago4 watchersCompare

[ Source](https://github.com/Cyber-Duck/fluent-debug)[ Packagist](https://packagist.org/packages/cyber-duck/fluent-debug)[ RSS](/packages/cyber-duck-fluent-debug/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (0)

🚨 Discontinued 🚨
================

[](#-discontinued-)

This package will no longer be supported.

Fluent / Chaining Methods/ Functions xDebug Library
===================================================

[](#fluent--chaining-methods-functions-xdebug-library)

\##Why?

Frameworks like Laravel make heavy usage of, and encourage, method chaining

Consider code like the following random line taken from Laravel framework:

```
Finder::create()
->files()
->name('*.php')
->in($configPath)

```

That looks lovely. But there's a problem. Suppose I'm interested in the return value of

```
Finder::create()
->files()
->name('*.php')

```

and I wish to examine this in a debugger.

At present, the only way I'm aware of doing this in PHP[1](#myfootnote1)with xDebug is either to step through it, or to tediously rewrite the code to introduce intermediate variables, i.e. rewrite the above to

```
$a = Finder::create()
->files()
->name('*.php')

//put breakpoint on this line:
$a->in($configPath)

```

which doesn't sound particularly difficult in this example but soon becomes a massive mess.

Let's consider another random line:

```
Chicken::load(meatProcess($sausage->bacon()));

```

Suppose I'm interested in the return value of `$sausage->bacon()` here. Where do I stick a breakpoint to get that? If I put it on the line, I have to step through the call to `bacon` and intercept the return value, which is sometimes rather difficult. Or perhaps I can put the breakpoint on the first line of the call to `meatProcess`. A third option is to do something like

```
Chicken::load(meatProcess(($a = $sausage->bacon())->ketchup()));
$a;

```

And put a breakpoint on the second line. But suppose the call to `ketchup` has altered `$a`? You're going to be misled!

And in any case, I'm messing up the code again.

This kind of thing is why some programmers are against method chaining in general - the debugging really is made much harder.

See for example

But we live in the real world and it's a popular way of doing things, and done well as with Laravel it makes your code so much simpler to read.

\##How?

So here I present a very simple extension that I believe takes out the vast majority of the debugging pain caused by fluent method chaining.

The extension is in two parts. Firstly, there is a trait with two methods. `debugBreak` and `debugBreakIf`. These are essentially wrappers around the `xdebug_break` function installed with xdebug.

Usage is like:

```
Finder::create()
->files()
->name('*.php')
->debugBreak()
->in($configPath)

```

or perhaps:

```
Finder::create()
->files()
->name('*.php')
->debugBreakIf(2 === $a)
->in($configPath)

```

or indeed:

```
Finder::create()
->files()
->name('*.php')
->debugBreakIf(function(){return app()->isRunningUnitTests();))
->in($configPath)

```

To use this, add `use CyberDuck\Traits\DebugsFluently` to any class where you wish to use it (or possibly its parent). On my ever increasing todo list is a plan to write something that will add this to every class for you automatically.

Secondly - primarily intended for usage in function chaining - are the global functions `debugBreak` and `debugBreakIf`.

The above example would become

```
Chicken::load(meatProcess(debugBreak($sausage->bacon())->ketchup()));

```

Or there is `debugBreakIf` - The second argument works in the same way as the `debugBreakIf` method in the trait.

\###Footnotes

1: There is a way in .NET - see

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~6 days

Total

3

Last Release

3367d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0c45a99726cc30692bc4821cfc198df1f5de85b1a15f9b66a0bf739acbac0309?d=identicon)[cyber-duck](/maintainers/cyber-duck)

---

Top Contributors

[![cyberduck-magento](https://avatars.githubusercontent.com/u/16756478?v=4)](https://github.com/cyberduck-magento "cyberduck-magento (1 commits)")[![karlos545](https://avatars.githubusercontent.com/u/9590468?v=4)](https://github.com/karlos545 "karlos545 (1 commits)")[![worzy](https://avatars.githubusercontent.com/u/1092417?v=4)](https://github.com/worzy "worzy (1 commits)")

---

Tags

breakpointsdebugginglaravelphpxdebug

### Embed Badge

![Health badge](/badges/cyber-duck-fluent-debug/health.svg)

```
[![Health](https://phpackages.com/badges/cyber-duck-fluent-debug/health.svg)](https://phpackages.com/packages/cyber-duck-fluent-debug)
```

###  Alternatives

[symfony/stopwatch

Provides a way to profile code

2.8k387.2M909](/packages/symfony-stopwatch)[fruitcake/laravel-debugbar

PHP Debugbar integration for Laravel

19.1k662.9k28](/packages/fruitcake-laravel-debugbar)[spatie/ignition

A beautiful error page for PHP applications.

510147.6M69](/packages/spatie-ignition)[jokkedk/webgrind

Webgrind is a Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job.

3.3k193.0k](/packages/jokkedk-webgrind)[koriym/printo

An object graph visualizer.

1421.8M2](/packages/koriym-printo)[soloterm/dumps

A Laravel command to intercept dumps from your Laravel application.

125285.7k3](/packages/soloterm-dumps)

PHPackages © 2026

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