Warning: You are browsing the documentation for Symfony 3.4, which is no longer maintained.

Read the updated version of this page for Symfony 5.3 (the current stable version).

How to Dump Workflows

3.4 version

How to Dump WorkflowsΒΆ

To help you debug your workflows, you can generate a visual representation of them as SVG or PNG images. First, download and install the Graphviz project, an open source graph visualization software which provides the dot command needed to generate the images.

If you are defining the workflow inside a Symfony application, run this command to dump it as an image:

$ php bin/console workflow:dump workflow-name | dot -Tsvg -o graph.svg

# run this command if you prefer PNG images:
$ php bin/console workflow:dump workflow-name | dot -Tpng -o graph.png

# highlight 'place1' and 'place2' in the dumped workflow
$ php bin/console workflow:dump workflow-name place1 place2 | dot -Tsvg -o graph.svg

The result will look like this:


If you are creating workflows outside of a Symfony application, use the GraphvizDumper class to dump the workflow representation:

// Add this code to a PHP script; for example: dump-graph.php
$dumper = new GraphvizDumper();
echo $dumper->dump($definition);
# replace 'dump-graph.php' by the name of your PHP script
$ php dump-graph.php | dot -Tsvg -o graph.svg

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.