"ddev-php-dumper" is a helper addon that redirects Symfony dump output to a server. Dumped data will no longer display inline on your site, but instead, be displayed in the terminal (var-dumper-server) or PHP Dumper, a Desktop Docker extension.
Using PHP Dumper offers several benefits:
If you project is based on Symfony (such as Laravel, Drupal), it may already include 'var-dumper'.
Install var-dumper, if you project does not already include it.
composer require --dev symfony/var-dumper
Install ddev-php-dump addon and restart to activate the addon.
ddev get tyler36/ddev-php-dumper
ddev restart
Next, you need to decide what dump server to use.
Requirements:
Install the PHP Dumper extension via Docker Desktop GUI or using the following command.
docker extension install artifision/php-dumper-docker-extension:latest
Create or update ./.ddev/.env
with:
VAR_DUMPER_SERVER="host.docker.internal"
Restart DDEV
ddev restart
Open PHP-dumper panel in Docker Desktop.
Example output:
Visit the test page, http://localhost:9913/dump to check if the extension can correctly receive data.
Open a terminal window and to start the dump server.
ddev dumper
The server should start and be listening on tcp://localhost:9912
Using a dump()
command in your project will display the output.
Example output:
dump()
the command in your project.The output will be redirect and displayed in your configured server.
To disable the service:
ddev service disable php-dumper
ddev restart
To re-enable the service:
ddev service enable php-dumper
ddev restart
For more information, see The Dump Server.
Contributed and maintained by @tyler36