views:

9893

answers:

5
+14  Q: 

PHP UML Generator

How do I generate UML diagram based on existing classes in PHP?

+2  A: 

Have you tried Autodia yet? Last time I tried it it wasn't perfect, but it was good enough.

Vinko Vrsalovic
i tried autodia but somehow i cant generate accurate class diagram (php5)
Jeffrey04
+1  A: 

There's also php2xmi. You have to do a bit of manual work, but it generates all the classes, so all you have to do is to drag them into a classdiagram in Umbrello.

Otherwise, generating a diagram with the use of reflection and graphviz, is fairly simple. I have a snippet over here, that you can use as a starting point.

troelskn
+8  A: 

There's also the PHP UML tool available from pear.

PHP_UML:

  • Can generate UML/XMI files in version 1.4, or in version 2.1 (logical, component, and deployment views)
  • Can generate an API documentation in HTML format
  • Can generate PHP code (code skeleton) from a given XMI file
  • Can convert UML/XMI content from version 1.4 to version 2.1

install it on the command line via:

$ pear install pear/php_uml-alpha

generate your xmi:

$ phpuml -o project.xmi

kguest
for some reason, pear.com doesn't like that link without a trailing slash:http://pear.php.net/package/PHP_UML/
Stephen J. Fuhry
@Stephen, yeah I noticed that too! If you click the link, it gives you a 404, but if you select the address bar and press enter, it works.
nickf
+1  A: 

the best (Windows) software i have found to do PHP and UML is Sparx Systems Enterprise Architect. besides a pletora of features, it supports the following for PHP:

  • Reverse engineer object oriented PHP into UML class diagrams
  • Generate PHP class definitions from UML class diagrams
  • Synchronize changes made in a UML class into the corresponding PHP class definition
  • Synchronize changes made in a PHP class definition into the corresponding UML class
  • Create UML sequence diagrams to show what PHP classes use and how they are used
  • Produce detailed documentation of your PHP code in standard RTF and HTML format
  • Perform code engineering on models to generate base PHP pages.

not free ($199), but definitely worth the money.

ax
+6  A: 

I strongly recommend BOUML. It's a free UML modelling application, which:

  • is extremely fast (fastest UML tool ever created, check out benchmarks),
  • has rock solid PHP import and export support (also supports C++, Java, Python)
  • is multiplatform (Linux, Windows, other OSes),
  • is full featured, impressively intensively developed (look at development history, it's hard to believe that such fast progress is possible).
  • supports plugins, has modular architecture (this allows user contributions, looks like BOUML community is forming up)
This really is a great tool, thanks
Andy
The benchmarks look really impressive. I love enterprise architect but it doesn't have PHP support. I will pass this tool on, thanks.
Paul Dragoonis