This is a Docker extension that allows you to dump variables in your PHP code using the well-known Symfony VarDumper component.
Install Docker Desktop if you don't have it already.
Run the following command in your terminal to install the extension or install it from the Docker Desktop Extensions marketplace:
docker extension install artifision/php-dumper-docker-extension:latestRun the following command in your project to install the VarDumper component if you don't have it already:
If you are using Symfony or Laravel, you don't need to install the component as it is already installed by default.
composer require --dev symfony/var-dumperYou need to tell your PHP application to forward the dump data to the extension:
-
If you have a
.envfile in your project, add the following line to it:VAR_DUMPER_FORMAT=server
-
If you don't use a
.envfile, you can add the following line at the beginning of your PHP code:$_SERVER['VAR_DUMPER_FORMAT'] = 'server';
-
If your project is on a Docker container, you need to add the following line to your
docker-compose.ymlfile under your PHP service configuration to allow the container to communicate with the local machine:extra_hosts: - "host.docker.internal:host-gateway"
In addition to the line above, you need to add the following line to your
.envfile or a PHP file as mentioned above:VAR_DUMPER_FORMAT=server VAR_DUMPER_SERVER=host.docker.internal:9912
Open the PHP Dumper extension in Docker Desktop and simply call dump() or dd() function in your PHP code and the
result will be displayed in the extension.
The extension uses ports 9912 and 9913 to communicate with your PHP application.
Make sure these ports are not used by other applications on your machine.
-
If you are unable to see the dump data in the extension, try opening the following URL in your browser to see if the extension is able to receive the data:
http://localhost:9913/dump -
If you still see the dump data in the browser but not in the extension, try updating the symfony/var-dumper package to the latest version:
composer update symfony/var-dumper
To remove the extension:
docker extension rm artifision/php-dumper-docker-extension:latestThe PHP Dumper is open-sourced software licensed under the MIT license.
Logo by Smashicons from Flaticon.
