tyler36 / ddev-php-dumper

Collect and manage 'dump' information in Docker Desktop

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tests project is maintained

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 get tyler36/ddev-php-dumper
    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

License:Apache License 2.0


Languages

Language:Shell 100.0%