Re: Pre-RFC: dd() and dump() functions for PHP core
| From: | Larry Garfield | Date: | Tue, 17 Jun 2025 21:20:19 +0000 |
| Subject: | Re: Pre-RFC: dd() and dump() functions for PHP core | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-127699@lists.php.net to get a copy of this message | ||
On Tue, Jun 17, 2025, at 2:54 PM, Braunson Yager wrote:
> Hi internals,
>
> I'd like to gauge interest in adding two debugging functions to PHP
> core: dd() and dump().
>
> *Background*
> Currently, developers rely on userland solutions like Laravel's dd()
> helper or Symfony's VarDumper for enhanced debugging output. These
> tools are widely adopted across the PHP ecosystem, suggesting strong
> demand for better debugging primitives.
>
> *Proposal Overview
> *- dd($var, ...$vars) - "dump and die" - outputs formatted debug info
> and terminates execution
> - dump($var, ...$vars) - outputs formatted debug info and continues
> execution
>
> *Enhanced Features Over Existing Solutions
> *- Native performance (no userland overhead)
> - Stack trace integration
> - Memory usage reporting
> - Execution timing (potentially)
> - Better CLI formatting
>
> *Why Core vs Userland?
> *Similar to how var_dump() provides basic introspection, these
> functions would offer enhanced debugging capabilities that benefit the
> entire ecosystem, not just framework users.
>
> *Implementation*
> I'm seeking collaboration with an experienced PHP core developer for
> the C implementation. I can handle the RFC documentation, testing, etc.
> I have experience with the Laravel/Symfony codebases.
>
> *Before drafting a formal RFC, I'd appreciate feedback on:
> *1. General appetite for enhanced debugging functions in core
> 2. Concerns about naming conflicts with existing userland helpers
> 3. Preferred feature scope
>
> Thoughts?
>
> Best regards,
> Braunson Yager
What exactly would dump() offer that's different/better than var_dump() already does today? Is
it just a pretty-printed var_dump()? I don't really see a need for that.
--Larry Garfield