Skip to content

Collect and manage 'dump' information in Docker Desktop

License

Notifications You must be signed in to change notification settings

tyler36/ddev-php-dumper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

add-on registry tests last commit release

ddev-php-dumper

What is ddev-php-dumper?

"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:

  • auto-expand dumps to a specific level
  • filter dumps by time frame
  • pin dumps
  • compare 2 dump

Dump

What does this add-on do?

  1. Sets environment variables to redirect "var_dump" output to PHP Dumper Docker extention.
  2. Includes helper function to start a PHP dump server.
  3. Adds Docker host as an extra host in the web container.

Requirements

If you project is based on Symfony (such as Laravel, Drupal), it may already include 'var-dumper'.

Installation

  1. Install var-dumper, if you project does not already include it.

    composer require --dev symfony/var-dumper
  2. Install ddev-php-dump addon and restart to activate the addon.

    ddev add-on get tyler36/ddev-php-dumper

    Then restart your project

    ddev restart

Next, you need to decide what dump server to use.

Docker "PHP Dump" setup

Requirements:

  1. Install the PHP Dumper extension via Docker Desktop GUI or using the following command.

    docker extension install artifision/php-dumper-docker-extension:latest
  2. Create or update ./.ddev/.env with:

    VAR_DUMPER_SERVER="host.docker.internal"
  3. Restart DDEV

    ddev restart
  4. Open PHP-dumper panel in Docker Desktop.

Example output: Dump

Troubleshooting

Visit the test page, http://localhost:9913/dump to check if the extension can correctly receive data.

"var-dump server" setup

  1. Open a terminal window and to start the dump server.

    ddev dumper
  2. The server should start and be listening on tcp://localhost:9912

alt text

Using a dump() command in your project will display the output.

Example output:

Dump

Usage

  • Use dump() the command in your project.

The output will be redirect and displayed in your configured server.

Disable the service

To disable the service:

ddev service disable php-dumper
ddev restart

To re-enable the service:

ddev service enable php-dumper
ddev restart

Reference

For more information, see The Dump Server.

Contributed and maintained by @tyler36

About

Collect and manage 'dump' information in Docker Desktop

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages