symfony-var-dumper-live

<small>It is assumed that in the root of your project there is a file `package.json`.</small>

Usage no npm install needed!

<script type="module">
  import symfonyVarDumperLive from 'https://cdn.skypack.dev/symfony-var-dumper-live';
</script>

README

This package can be easily used in your Symfony projects.

It allows you to debug through Symfony VarDumper server (bin/console dump:server), providing a convenient and beautiful information output in the browser and without reloading the page.

Thus, you use the dump() function in your code, anywhere, for example, when do you request to REST API, or in the console command and all the information will be displayed in your browser in live mode.

Features:

  • the display is nicely tuned through CSS, the animation of a new messages
  • you can open / close levels (Ctrl + Left Click opens all lower levels)
  • output time in current time zone format and locale (If you are an Arab, then the date will be of this kind: "٢٠‏/١٢‏/٢٠١٢")
  • search by individual messages with convenient display
  • clearing the page from messages
  • you can select the background color (the selection is saved)
  • you can change the width of the container (the selection is saved)

I can add a lot more, write sentences!

Installation

It is assumed that in the root of your project there is a file package.json.

npm install --save-dev symfony-var-dumper-live
# Or if you're using Yarn
yarn add --dev symfony-var-dumper-live

Using

You need to start two servers (server:dump and server of this package), fortunately this can be done with one command:

npx server:dump-live --run-dump
# Or if you're using Yarn
yarn server:dump-live --run-dump

There is a second way:

You can run the server:dump manually:

php ./bin/console server:dump --format=html > dump.html

and then simply run the package without the --run-dump argument.

--help

The following options are available:

Options:
  -v, --version      output the version number
      --host [host]  server host (default: "127.0.0.1")
  -p, --port [port]  server port (default: 9000)
  -b, --path [path]  path to file generated by Symfony's "server:dump" command.
(default: "dump.html")
  -r, --run-dump     manually runs Symfony's "server:dump" command (uses dump.ht
ml).
  --no-open          it won't open your browser.
  -h, --help         output usage information

How it works

Command server:dump-live --run-dump starts the Symfony VarDumper server (bin/console dump:server), and another server on the Node.js which you can open in the browser, this package (CLI process) is watching the file changes (dump.html) which makes a symphony server. When the html file is changed through the symphony (and added new messages to this file), a signal is sent to the browser through sockets and the browser displays these messages on the page.

TODO

  • tests
  • checkbox indicating whether the information is initially open (I'm talking about where you can manually open / close it.)
  • icon for the page
  • different output style
  • time in the style of "5 seconds ago", "2 minutes ago"