2017 © Pedro Peláez
 

project php-plantumlwriter

A tool to create PlantUML class diagrams from your PHP source.

image

davidfuhr/php-plantumlwriter

A tool to create PlantUML class diagrams from your PHP source.

  • Monday, March 28, 2016
  • by davidfuhr
  • Repository
  • 6 Watchers
  • 68 Stars
  • 8,899 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 21 Forks
  • 8 Open issues
  • 9 Versions
  • 1 % Grown

The README.md

php-plantumlwriter

Build Status Scrutinizer Code Quality SensioLabsInsight License, (*1)

Description

A tool to create PlantUML class diagrams from your PHP source., (*2)

Currently the following language features are supported:, (*3)

  • Property and method visibility
  • Static properties and methods
  • Method return types from doc comment
  • Parameter types from type hinting and doc comment
  • Parameter default values
  • Class constants with value
  • Property types from doc comment
  • Property default values
  • Implemented interfaces and parent classes
  • Abstract classes

Requirements

To generate the PlantUML code a decent version of PHP will suffice. And you need Composer to install the dependencies:, (*4)

  • Composer (http://getcomposer.org/)

But for image generation you need:, (*5)

  • Java Runtime
  • plantuml.jar (http://plantuml.sourceforge.net/)

Phar generation

php-plantumlwriter uses Box 2 library to generate a single .phar file containing everything required for the usage., (*6)

To create the .phar file from sources just run:, (*7)

$ box build

Usage

To generate the PlantUML code for WriteCommand.php run, (*8)

php bin/php-plantumlwriter write src/Flagbit/Plantuml/Command/WriteCommand.php > WriteCommand.puml

which will output, (*9)

@startuml
class Flagbit.Plantuml.Command.WriteCommand {
    #configure()
    #execute(input: Symfony.Component.Console.Input.InputInterface, output: Symfony.Component.Console.Output.OutputInterface)
}
class Flagbit.Plantuml.Command.WriteCommand extends Symfony.Component.Console.Command.Command
@enduml

Now you can convert your puml file to a png file.:, (*10)

java -jar plantuml.jar WriteCommand.puml

The resulting png should look like this:, (*11)

WriteCommand Class Diagram, (*12)

If you have a large class with lots of methods you can suppress method printing using the --without-methods flag:, (*13)

php bin/php-plantumlwriter write --without-methods path/to/your/LargeClass.php

Other available options are --without-properties and --without-constants., (*14)

You can also generate a whole directory at once:, (*15)

php bin/php-plantumlwriter write path/to/directory

Or multiple files or directories:, (*16)

php bin/php-plantumlwriter write path/to/ClassOne.php path/to/ClassTwo.php path/to/directory

Known Issues

  • Imported classes are currently not handled correctly if read from doc comment (use-Statement is not fully evaluated) which affects return values and property types. use Namespace\B will be evaluated and expanded but use Namespace\B as C is not yet de-aliased.
  • The Namespace Seperator is "." and not "\".
  • Traits are not yet supported. See #4

Future Plans

  • Add support for class relations, maybe with quantifiers. This could be parsed from the doc comments. We could also guess the foreign quantifier (@var OtherClass as "..1" and @var OtherClass[] as "..*"), but we can't determine our quantifier. If doctrine annotations are present we can use them.
  • Evaluate Implementation of Visitor Pattern
  • Implement own set of Interfaces

Alternatives

  • http://westhoffswelt.de/projects/phuml.html

The Versions

28/03 2016

dev-master

9999999-dev

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

28/09 2015

1.6.0

1.6.0.0

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

07/09 2015

1.5.0

1.5.0.0

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

05/12 2014

dev-dev/relations

dev-dev/relations

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

02/07 2014

dev-namespacesep

dev-namespacesep

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

02/07 2014

1.4

1.4.0.0

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

02/07 2014

1.2

1.2.0.0

A tool to create PlantUML class diagrams from your PHP source.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

uml

12/07 2013
30/06 2013