Composer Viz#

Packagist GitLab GitHub Bitbucket Gitea

A Composer plugin to generate dependency graph by GraphViz inspired by bundle viz.


Install globally so you can use it on any project:

composer global require arokettu/composer-viz:^2.2

The system should have GraphViz installed.


composer viz [-o|--output OUTPUT] [-f|--format FORMAT]
             [--no-dev] [--no-php] [--no-ext] [--no-platform]
             [--no-pkg-versions] [--no-dep-versions] [--no-versions]
-o OUTPUT, --output=OUTPUT

Set output file. If not set, the result will be displayed from temporary file

-f FORMAT, --format=FORMAT

Set output file format. Useful if it is not detected from --output


Do not show development dependencies


Do not show PHP as a dependency (php and php64)


Do not show extensions as dependencies


--no-php + --no-ext


Do not show package versions on graph vertices


Do not show package versions on graph edges


--no-pkg-versions + --no-dep-versions


Running composer-viz 2.3.0 for itself: composer viz --output=composer-viz-2.3.0.svg


More artificial example that shows more features (for sandbox/composer.json):



  • Green: root package

  • White: regular package

  • Grey: development dependency

  • Blue: platform package (PHP, extensions, Composer API)

  • Red: package is provided by another package


  • Black: regular dependency

  • Grey: development dependency

  • Red: ‘provided by’ relationship


You should install GraphViz on your system first.

Use this in Ubuntu:

sudo apt-get install graphviz

Sometimes you may need additional packages like in Fedora you should also install graphviz-gd to be able to export images, like this:

# dot, svg and postscript work without graphviz-gd but png, jpeg and gif don't
sudo dnf install graphviz graphviz-gd


The library is available as open source under the terms of the MIT License.