Skip to content

Conversation

maryo
Copy link

@maryo maryo commented Sep 23, 2025

  • bug fix / new feature? 🤷‍♂️
  • BC break? no

Symfony VarDumper (a dependency of many packages, so it is often installed even when you don't want it) often takes over the dump function when both are installed.

It also conditionally defines it, and unfortunately, it’s impossible to control which definition gets included first. Due to the same reason, it’s also not (in most cases) possible to define a custom function and let composer autoload it using "autoload": {"files": [. The only option is to require it manually before the Composer autoloader (which, in some tools like PHPUnit, is even required automatically first).

At least Symfony allows registering a custom handler using VarDumper::setHandler(...), so it’s possible to redirect it to Tracy’s dump, which I prefer 🙂. There is a minor issue, though: the location resolved from the stack trace points to VarDumper instead.

If this got accepted, I can add the PR to docs too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant