larapack/dd
Adds Laravel-style dd() “dump and die” helper to any PHP app. Useful for non-Laravel projects or for overriding Laravel 4’s dd() with the Laravel 5 equivalent. Install via Composer and, on Laravel 4, require the helper in public/index.php.
This package provides legacy dd() and d() helper functions for debugging in PHP. However, Laravel 5.0+ already includes dd() natively, making this package redundant for modern applications. Unless you're maintaining a legacy Laravel 4 app, you should not install it.
If you do need it (e.g., Laravel 4.x project):
composer require larapack/dd 1.*
Then, in public/index.php, add after <?php:
require __DIR__.'/../vendor/larapack/dd/src/helper.php';
First use: inspect a variable mid-flow without halting execution:
d($user->toArray(), 'User data before save');
// Execution continues...
dd($request->all()); // Dumps and terminates script
d($var) inside controllers or middleware to inspect state without var_dump() clutter:
d($validated, 'After validation'); // non-fatal dump
env() checks for dev-only debugging:
if (app()->isLocal()) {
d($sensitiveData, 'Debug context');
\Log::info('Debug trace', ['payload' => $sensitiveData]);
}
dd(), d() won’t exit—ideal for artisan commands where you want output and continuation:
d($progress, 'Step X complete');
⚠️ Pro Tip: Modern Laravel (5.6+) supports dump() and dd() natively—no package needed. The native dd() even supports chained calls (e.g., d($a); d($b);).
dd() may cause subtle differences in output formatting or error handling (especially on PHP 8+).public/index.php) can break during Laravel upgrades—your override may point to outdated code while Laravel’s core evolves.dd() is superior, actively maintained, and supports customVarCloner for rich CLI output.dd()/dump().symfony/var-dumper directly: composer require --dev symfony/var-dumper.d() is useful, but Laravel’s dump() (added in 5.6) does the same thing better, including HTML-aware output in browser.How can I help you explore Laravel packages today?