The Command-Line
The command-line interface is the easiest way to try and learn the basic UmlWriter features.
For all users.
Command-Line Options
When you invoke the umlwriter
command, you should obtain the following commands and options :
___ __ _ _ _ _ _ __ ___ | \ \ / / __(_) |_ ___ _ __ | | | | '_ ` _ \| |\ \ /\ / / '__| | __/ _ \ '__| | |_| | | | | | | | \ V V /| | | | || __/ | \__,_|_| |_| |_|_| \_/\_/ |_| |_|\__\___|_| umlWriter version 1.2.0 Usage: command [options] [arguments] Options: -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --manifest Show which versions of dependencies are bundled. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: help Displays help for a command list Lists commands diagram diagram:render Generate diagram statements of all objects diagram:render:class Generate diagram statements of a single class diagram:render:namespace Generate diagram statements of a single namespace
- diagram:render
-
Generate diagram statements of all objects.
$ umlwriter diagram:render --processor=graphviz src/Bartlett/UmlWriter/Processor
digraph G { overlap = false; node [fontname="Verdana", fontsize="8", shape="none", margin="0", fillcolor="#FEFECE", style="filled"]; edge [fontname="Verdana", fontsize="8"]; subgraph cluster_0 { label="Bartlett\\UmlWriter\\Processor"; "Bartlett\\UmlWriter\\Processor\\AbstractProcessor" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>abstract</i></font> >><br/><b>AbstractProcessor</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left"># reflector</td></tr> <tr><td align="left"># graphId</td></tr> <tr><td align="left"># objects</td></tr> <tr><td align="left"># edges</td></tr> <tr><td align="left">- spaces</td></tr> <tr><td align="left">- linebreak</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+__construct()</td></tr> <tr><td align="left">+setGraphId()</td></tr> <tr><td align="left">+renderClass()</td></tr> <tr><td align="left">+renderNamespace()</td></tr> <tr><td align="left">+render()</td></tr> <tr><td align="left">#renderEdges()</td></tr> <tr><td align="left">#formatLine()</td></tr> <tr><td align="left">#writeObjectElement()</td></tr> <tr><td align="left">#writeObjectInheritance()</td></tr> <tr><td align="left">#writeObjectInterfaces()</td></tr> <tr><td align="left">#writeConstantElements()</td></tr> <tr><td align="left">#writePropertyElements()</td></tr> <tr><td align="left">#writeMethodElements()</td></tr> <tr><td align="left">#<i>pushObject</i>()</td></tr> <tr><td align="left">#<i>pushEdge</i>()</td></tr> <tr><td align="left">#formatClassStereotype()</td></tr> <tr><td align="left">-reset()</td></tr> </table></td></tr> </table> >]; "Bartlett\\UmlWriter\\Processor\\GraphvizProcessor" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>class</i></font> >><br/><b>GraphvizProcessor</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left"># namespaceSeparator</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">#renderObjects()</td></tr> <tr><td align="left">#renderEdges()</td></tr> <tr><td align="left">#writeGraphHeader()</td></tr> <tr><td align="left">#writeGraphFooter()</td></tr> <tr><td align="left">#pushObject()</td></tr> <tr><td align="left">#pushEdge()</td></tr> <tr><td align="left">-attributes()</td></tr> </table></td></tr> </table> >]; "Bartlett\\UmlWriter\\Processor\\ProcessorInterface" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>interface</i></font> >><br/><b>ProcessorInterface</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+ GLOBAL_NAMESPACE</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+renderClass()</td></tr> <tr><td align="left">+renderNamespace()</td></tr> <tr><td align="left">+render()</td></tr> </table></td></tr> </table> >]; "Bartlett\\UmlWriter\\Processor\\PlantUMLProcessor" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>class</i></font> >><br/><b>PlantUMLProcessor</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left"># namespaceSeparator</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">#renderObjects()</td></tr> <tr><td align="left">#renderEdges()</td></tr> <tr><td align="left">#writeGraphHeader()</td></tr> <tr><td align="left">#writeGraphFooter()</td></tr> <tr><td align="left">#pushObject()</td></tr> <tr><td align="left">#pushEdge()</td></tr> </table></td></tr> </table> >]; } "Bartlett\\UmlWriter\\Processor\\GraphvizProcessor" -> "Bartlett\\UmlWriter\\Processor\\AbstractProcessor"; "Bartlett\\UmlWriter\\Processor\\GraphvizProcessor" -> "Bartlett\\UmlWriter\\Processor\\ProcessorInterface" [arrowhead="empty", style="dashed"]; "Bartlett\\UmlWriter\\Processor\\PlantUMLProcessor" -> "Bartlett\\UmlWriter\\Processor\\AbstractProcessor"; "Bartlett\\UmlWriter\\Processor\\PlantUMLProcessor" -> "Bartlett\\UmlWriter\\Processor\\ProcessorInterface" [arrowhead="empty", style="dashed"]; }
That may render something like
- diagram:render:class
-
Generate diagram statements of a single class.
$ umlwriter diagram:render:class --processor=graphviz vendor/bartlett/php-reflect/src Bartlett\Reflect
digraph G { overlap = false; node [fontname="Verdana", fontsize="8", shape="none", margin="0", fillcolor="#FEFECE", style="filled"]; edge [fontname="Verdana", fontsize="8"]; subgraph cluster_0 { label="Bartlett"; "Bartlett\\Reflect" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>class</i></font> >><br/><b>Reflect</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">- analysers</td></tr> <tr><td align="left">- dataSourceId</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+__construct()</td></tr> <tr><td align="left">+addAnalyser()</td></tr> <tr><td align="left">+getAnalysers()</td></tr> <tr><td align="left">+setDataSourceId()</td></tr> <tr><td align="left">+getDataSourceId()</td></tr> <tr><td align="left">+parse()</td></tr> </table></td></tr> </table> >]; } subgraph cluster_1 { label="Bartlett\\Reflect\\Event"; "Bartlett\\Reflect\\Event\\AbstractDispatcher" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>class</i></font> >><br/><b>AbstractDispatcher</b></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left"># eventDispatcher</td></tr> </table></td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+setEventDispatcher()</td></tr> <tr><td align="left">+getEventDispatcher()</td></tr> <tr><td align="left">+dispatch()</td></tr> <tr><td align="left">+addSubscriber()</td></tr> </table></td></tr> </table> >]; "Bartlett\\Reflect\\Event\\DispatcherInterface" [label=< <table border="0" cellborder="1" cellspacing="0"> <tr><td align="center"><< <font color="black"><i>interface</i></font> >><br/><b>DispatcherInterface</b></td></tr> <tr><td> </td></tr> <tr><td><table border="0" cellspacing="0" cellpadding="2"> <tr><td align="left">+setEventDispatcher()</td></tr> <tr><td align="left">+getEventDispatcher()</td></tr> <tr><td align="left">+dispatch()</td></tr> <tr><td align="left">+addSubscriber()</td></tr> </table></td></tr> </table> >]; } "Bartlett\\Reflect\\Event\\AbstractDispatcher" -> "Bartlett\\Reflect\\Event\\DispatcherInterface" [arrowhead="empty", style="dashed"]; "Bartlett\\Reflect" -> "Bartlett\\Reflect\\Event\\AbstractDispatcher"; }
That may render something like
- diagram:render:namespace
-
Generate diagram statements of a single namespace.
$ umlwriter diagram:render:namespace --processor=plantuml vendor/bartlett/php-reflect/src Bartlett\Reflect\Plugin\Notifier
@startuml namespace Bartlett.Reflect.Plugin.Notifier { class GrowlNotifier << class >> { -growl -format -- +__construct() +setMessageFormat() +getMessageFormat() +notify() } interface NotifierInterface << interface >> { +setMessageFormat() +getMessageFormat() +notify() } } Bartlett.Reflect.Plugin.Notifier.GrowlNotifier ..|> Bartlett.Reflect.Plugin.Notifier.NotifierInterface @enduml
That may render something like
Summary
Let’s review what we’ve learned about the command-line interface :
-
It’s a Symfony Console Component that can be extended.
-
We can produced Graphviz or PlantUML code syntax ready for image generation.
Next
For PHP developers only.