plantUML:run command to print UML diagrams

Future release 2.0.0RC3 adopt another new command

After conversion of concrete example "Measuring the size of a PHP project" to a new command (see previous post), I’ve decided to include in future release 2.0.0RC3 a new command plantUML:run (commit 566bf46).

This plugin will replace the concrete example "Make UML diagrams".

With this plugin you can make package UML diagram (http://plantuml.sourceforge.net/classes.html#Using), e.g : with such simple reflect.json config file.

{
    "source-providers": [
        {
            "in": "phar:///var/dist/phpreflect-2.0.0RC2-6-ge55464a.phar as Reflect2RC2",
            "path": "src/",
            "name": "*.php"
        }
    "plugins": [
        {
            "name": "PlantUML",
            "class": "Bartlett\\Reflect\\Plugin\\PlantUML\\PlantUMLPlugin"
        }
}
Example 1. Run the command below
$ php bin/reflect --profile --plantUML:run --alias Reflect2RC2 --package="Bartlett\Reflect\Model"

You will get such output.

package "Bartlett\\Reflect\\Model" {
abstract AbstractFunctionModel
abstract AbstractModel
class ClassModel
class ConstantModel
class DependencyModel
class FunctionModel
class IncludeModel
class MethodModel
class PackageModel
class ParameterModel
class PropertyModel
}

Put in in a file , e.g packageDiagram.plantuml, and send the result to plantUML

$ java -jar plantuml.jar packageDiagram.plantuml

and you will get a PNG image as this one :

bartlett_reflect_model.packagediagram.png
Example 2. Run the command below
$ php bin/reflect --profile --plantUML:run --alias Reflect2RC2 --class="Bartlett\Reflect"

You will get such output.

class Reflect{
    #pm
    #files
    +getProviderManager()
    +setProviderManager()
    +parse()
    +getPackages()
    +getFiles()
    -buildFromCache()
}
AbstractDispatcher <|-- Reflect
interface ManagerInterface {
}
ManagerInterface <|.. Reflect

Put in in a file , e.g classDiagram.plantuml, and send the result to plantUML

$ java -jar plantuml.jar classDiagram.plantuml

and you will get a PNG image as this one :

bartlett_reflect.classdiagram.png
Published by Laurent Laville on 2014-02-23