Symfony VarDumper

repository·8.2·Indexed 27 days ago

https://github.com/symfony/var-dumper

A PHP component providing advanced mechanisms for inspecting and walking through arbitrary variables as a readable alternative to var_dump(). Includes a dump server via the server:dump command and var-dump-server binary to collect and display dumps in CLI or HTML formats.

Tokens
519
Snippets
0
Records
6
Agent score
93%

What's inside symfony/var-dumper

  1. Use the VarDumper component for variable inspection

    8.2
    The VarDumper component provides a superior alternative to PHP's native var_dump() function. It offers a dump() function designed to walk through any arbitrary PHP variable, providing a more readable and structured output for debugging purposes.
  2. Configure the output format for server:dump

    8.2

    The server:dump command supports different output formats via the --format option. By default, it uses cli.

    Available Formats

    • cli: Standard command-line output.
    • html: Formatted HTML output, ideal for viewing in a web browser.

    Usage Examples

    View dumps in the terminal (default):

    php server:dump

    Generate an HTML file to view in a browser: Redirect the output to an HTML file using the --format=html option:

    php server:dump --format="html" > dump.html
  3. Start the VarDumper server

    8.2

    The var-dump-server binary starts a server that collects and outputs dumps in a single location, supporting multiple formats. By default, it listens on 127.0.0.1:9912.

    To run the server, ensure you have installed the dependencies via Composer and that the symfony/console component is available in your project.

  4. Start the VarDumper dump server with server:dump

    8.2

    The server:dump command starts a dump server that collects and displays dumps from your application in a single place. This is useful for debugging applications where standard output might be difficult to access or when you want to view dumps in a structured HTML format.

    To run the server, use the following command:

    php bin/console server:dump

    (Note: Replace bin/console with the actual path to your console executable.)