Skip to main content

What is the Dumpable trait?

Illuminate\Support\Traits\Dumpable is a small trait that adds dump() and dd() to any class. It was introduced in Laravel 10 and is widely used to provide a consistent debugging experience across core APIs such as Collection, Eloquent Builder, and Request. The goal is simple: inspect an object quickly, and optionally stop execution at that exact point.

Check the implementation

The implementation is minimal. It only forwards to dump($this, ...$args) and dd($this, ...$args).
In Laravel 13, the source lives in src/Illuminate/Support/Traits/Dumpable.php. The runtime implementation expresses return behavior via PHPDoc (@return $this and @return never).

Add it to your own class

Add use Dumpable; and your class gets dump() / dd() as instance methods.

Debug in the middle of a fluent chain

dump() returns static (implemented as $this), so you can insert it safely in method chains.
If you switch to dd(), execution stops at that exact point, which is useful before expensive or side-effect-heavy steps.

Using it in package development

Adding Dumpable to your own Value Objects, DTOs, and Builder classes gives package users a built-in way to inspect internal state.
1

Add it to a Value Object / DTO

2

Use it in a fluent builder chain

Passing extra arguments

Because Dumpable calls dump($this, ...$args) and dd($this, ...$args), you can pass contextual labels together with the object.
This is useful when you have multiple dump points and need to identify each one immediately.

tap() helper / Tappable

Learn how to insert side effects while returning the original value.

The Conditionable trait

Learn conditional branching in fluent chains.

The Macroable trait

Learn how to extend existing classes with custom methods.
Last modified on July 13, 2026