Generate a DOT file
The phuml:dot
command will generate a DOT file by scanning the code from a given directory.
Why would you want a DOT file?
Imagine you don't want to produce a png
class diagram but a searchable pdf
file.
You could run the phuml:dot
command to generate a gv
file.
Then you might call neato
to produce your pdf
vendor/bin/phuml phuml:dot tests/resources/.code output.gv
neato -Tpdf output.gv > output.pdf
rm -f output.gv
Arguments and options
The phuml:dot
command has the following arguments:
directory
. The directory with the code to be scanned to generate the DOT fileoutput
. The file name for yourgv
file
It has the following options:
associations
(-a
). If present, the command will generate association among classes. It will extract them from the types of the attributes of the class/interface. It will also use the types from the arguments passed to the constructorrecursive
(-r
). If present, it will scan the givendirectory
recursivelyhide-private
(-i
). If present, it will exclude private methods and attributeshide-protected
(-o
). If present, it will exclude protected methods and attributeshide-attributes
(-t
). If present, it will exclude all the attributeshide-methods
(-m
). If present, it will exclude all the methodshide-empty-blocks
(-b
). If present, no empty blocks will be generatedtheme
(-e
). Colors and fonts to be used for the diagram. There are 3 themes to choose from:phuml
, which is the default theme,php
, andclassic
Examples
- The following command will produce a DOT file from the
src
directory. - The DOT file will be saved to the file
example.gv
in the current directory. - It will search for classes and interfaces recursively, because of the
-r
option. - It will generate associations (
-a
), by inspecting attributes and constructor parameters in all the classes. - It will only show public methods and attributes because both options
-i
and-o
are present
# Composer installation
vendor/bin/phuml phuml:dot -r -a -i -o src example.gv
# Docker installation
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:dot -r -a -i -o src example.gv
# Phive installation
tools/phuml phuml:dot -r -a -i -o src example.gv
- The following command will produce a DOT file from the
src
directory. - The diagram will be saved to the file
example.gv
in the current directory. - It will search for classes and interfaces recursively, because of the
-r
option. - It will only show names because both options
-t
and-m
are present. - Option
-a
is not present since there are no attributes or constructors to look for associations.
# Composer installation
vendor/bin/phuml phuml:dot -r -t -m src example.gv
# Docker installation
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:dot -r -t -m src example.gv
# Phive installation
tools/phuml phuml:dot -r -t -m src example.gv
- The following command will produce a DOT file from the
src
directory. - The diagram will be saved to the file
example.gv
in the current directory. - It will search for classes and interfaces recursively, because of the
-r
option. - It will only show names because both options
-t
and-m
are present. - Option
-a
is not present since there are no attributes nor constructors to look for associations. - It will not create rows for methods and attributes because of the
-b
option.
# Composer installation
vendor/bin/phuml phuml:diagram -r -t -m -b src example.gv
# Docker installation
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:diagram -r -t -m -b src example.gv
# Phive installation
tools/phuml phuml:diagram -r -t -m -b src example.gv
- The following command will produce a DOT file from the
src
directory. - The DOT file will be saved to the file
example.gv
in the current directory. - It WILL NOT search for classes and interfaces recursively, because of the lack of the
-r
option. - It WILL NOT generate associations because of the lack of the
-a
option. - It will show all methods and attributes because both options
-i
and-o
are absent
# Composer installation
vendor/bin/phuml phuml:dot src example.gv
# Docker installation
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:dot src example.gv
# Phive installation
tools/phuml phuml:dot src example.gv
- The following command will produce a DOT file from the
src
directory. - The DOT file will be saved to the file
example.gv
in the current directory. - It WILL NOT search for classes and interfaces recursively, because of the lack of the
-r
option. - It WILL NOT generate associations because of the lack of the
-a
option. - It will show all methods and attributes because both options
-i
and-o
are absent - It will use colors purple and white because the option
e
is thephp
theme
# Composer installation
vendor/bin/phuml phuml:dot -e php src example.gv
# Docker installation
docker run --rm -v $PWD:/code montealegreluis/phuml phuml:dot -e php src example.gv
# Phive installation
tools/phuml phuml:dot -e php src example.gv