Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Dd Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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

Implementation Patterns

  • Temporary debugging hooks: Use d($var) inside controllers or middleware to inspect state without var_dump() clutter:
    d($validated, 'After validation'); // non-fatal dump
    
  • Conditional logging + dumping: Combine with env() checks for dev-only debugging:
    if (app()->isLocal()) {
        d($sensitiveData, 'Debug context');
        \Log::info('Debug trace', ['payload' => $sensitiveData]);
    }
    
  • Preventing output in CLI: Unlike 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);).

Gotchas and Tips

  • Obsolescence risk: Last updated in 2016; conflicts with Laravel’s built-in dd() may cause subtle differences in output formatting or error handling (especially on PHP 8+).
  • Autoload conflicts: Manually requiring the helper (public/index.php) can break during Laravel upgrades—your override may point to outdated code while Laravel’s core evolves.
  • No value in new projects: Installing this adds dependency churn with zero benefit. Laravel’s dd() is superior, actively maintained, and supports customVarCloner for rich CLI output.
  • Better alternatives:
    • Use Laravel’s native dd()/dump().
    • For standalone CLI dumping, install symfony/var-dumper directly: composer require --dev symfony/var-dumper.
  • Debugging without dying: d() is useful, but Laravel’s dump() (added in 5.6) does the same thing better, including HTML-aware output in browser.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4
php-http/client-implementation
phpcr/phpcr-implementation
cucumber/gherkin-monorepo
haydenpierce/class-finder
psr/simple-cache-implementation