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

Var Dumper Laravel Package

symfony/var-dumper

Symfony VarDumper provides a smarter dump() for inspecting PHP variables, replacing var_dump() with rich, readable output. It can walk complex data structures, improving debugging in CLI and web contexts with configurable dumpers and casters.

View on GitHub
Deep Wiki
Context7

Provides mechanisms for walking through any arbitrary PHP variable

Frequently asked questions about Var Dumper
Does Symfony VarDumper work with Laravel’s built-in `dump()` and `dd()` functions?
Yes, Laravel’s `dump()` and `dd()` already use Symfony VarDumper under the hood (since Laravel 6+). No changes are needed—just install the package to upgrade to the latest features or fix bugs in the version Laravel bundles.
How do I install Symfony VarDumper in a Laravel project?
Run `composer require symfony/var-dumper` to install the latest stable version. Laravel’s `dump()` and `dd()` will automatically use it. For CLI debugging, use `php artisan tinker` or `php artisan dump-server` for persistent inspection.
Can I customize how VarDumper displays Laravel-specific objects like Eloquent models or Livewire components?
Absolutely. Use `addDefaultCasters()` to register custom casters for your objects. For example, create a caster for Eloquent models to show only relevant attributes or relationships. Check Symfony’s documentation for the `Caster` interface.
What PHP versions does Symfony VarDumper support in Laravel projects?
VarDumper v7.x supports PHP 8.1+, while v8.x requires PHP 8.4+. Laravel 10+ uses PHP 8.1+, so v7.4+ is a safe choice. Always check Laravel’s requirements and Symfony’s changelog for version-specific features.
Is Symfony VarDumper safe to use in production? How do I disable it?
VarDumper is designed for development only. Disable it in production by setting `APP_DEBUG=false` in your `.env`. For extra safety, wrap `dump()` calls in environment checks like `if (app()->environment('local')) { dump($var); }`.
How does VarDumper handle sensitive data like passwords or API keys in Laravel?
VarDumper doesn’t filter sensitive data by default. Use Symfony’s `RequestContextProvider` or custom casters to mask sensitive fields (e.g., passwords in `Request` objects). Always restrict `dump()` to non-production environments.
Can I use Symfony VarDumper for browser debugging in Laravel, or is it CLI-only?
VarDumper supports both CLI and browser debugging. For web output, use `HtmlDumper` to render HTML instead of plain text. However, for GUI-heavy debugging, Laravel Debugbar or Ray might offer a more polished experience.
What are the performance implications of using VarDumper in Laravel?
VarDumper has minimal overhead in debug mode. Avoid using it in production or high-frequency loops (e.g., API rate-limited endpoints). For performance-critical paths, use structured logging or disable `APP_DEBUG` entirely.
How does Symfony VarDumper integrate with Laravel’s testing tools like PestPHP or PHPUnit?
VarDumper enhances testing by providing interactive variable inspection in PestPHP and PHPUnit. Use `dump()` in test assertions to debug complex data structures. For CI/CD, it helps diagnose failed tests by revealing variable states during builds.
What alternatives to Symfony VarDumper exist for Laravel debugging, and when should I choose them?
Alternatives include Laravel Debugbar (GUI-based), Ray (proprietary with advanced features), and Telescope (structured logging). Use VarDumper for lightweight CLI/terminal debugging, Debugbar for browser-based inspection, and Telescope for production monitoring.
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai