omouren/external-var-dumper-bundle

Externalize Symfony VarDumper dumps

Installs: 43 568

Dependents: 0

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 2

Open Issues: 1

Type:symfony-bundle

1.0.8 2022-11-22 16:42 UTC

This package is auto-updated.

Last update: 2024-05-22 19:37:54 UTC


README

SensioLabsInsight

The ExternalVarDumperBundle allows you to redirect Symfony dumps (VarDumper) to an external web service. Usefull to debug applications like REST APIs, background console commands or other applications that you don't have a direct output or that you can't break with a dump in the middle of the response.

Installation

Via Composer

$ composer require omouren/external-var-dumper-bundle

Register the bundle in the application kernel :

<?php
// app/AppKernel.php
// ...
public function registerBundles()
{
    $bundles = [
        // ...
        new Omouren\ExternalVarDumperBundle\OmourenExternalVarDumperBundle(),
        // ...
    ];
// ...

Add configuration (optional) :

# app/config/config.yml
omouren_external_var_dumper:
    uri: http://localhost:1337  # Uri to use for the query to the external service
    method: post                # HTTP method used by the query to the external service
    app_name: Symfony           # Added to the query to identify your dump source
    enabled: false              # Define if dumps are send to the external service

Usage

<?php
// ...
dump($var);

It will send a query to the external web service in JSON:

{
    "app":"Symfony",
    "id":"sf-dump-1542914713",
    "content":"html content of the symfony dump",
    "source":{
        "name":"DefaultController.php",
        "line":21
    },
    "datetime":"2018-04-06T20:04:37+00:00"
}

VarDumper Viewer

Viewer in Vue.js to catch and see your dumps : external-var-dumper-viewer

With Pre-built Docker image

# By default, internaly server use port 8080
$ docker run --rm -p 80:8080 -ti omouren/external-var-dumper-viewer:latest
# You can override it with custom port by an environment variable
$ docker run --rm -e "PORT=1337" -p 80:1337 -ti omouren/external-var-dumper-viewer:latest
# Now go to http://localhost:80

Var Dumper Viewer