Proposal for "UML"

» Metadata » Status
» Description
PHP_UML is an XMI-based reverse-engineering tool, as well as a metamodel-driven application.

Practically, with PHP_UML, you can feed an UML CASE tool, like Rational Rose or Argouml, with an UML representation of some existing PHP source code. This way you get an immediate overview of an application, with all the usual functions of a software design tool, like class diagrams exportation, refactoring of object-oriented applications, or automatic code generation.

PHP_UML is three parts :

* It is a PHP parser
* It is a PHP metamodel, that provides a set of MOF-oriented classes, as well as a parameterized class, in order to build collections of program elements
* It is an XMI code generator (most UML softwares can import XMI code, this is how you will get the object model of your PHP application into your design tool)

You can use all, or any of these three functions. Don't be afraid by the second, it is more straightforward than it sounds.

What does it generate ?

PHP_UML generates a logical view (composed of the packages and classes found), a component view, and a deployment view (through a mapping of the filesystem).

What does it parse ?
- Reads your classes, interfaces, inheritances and implementations
- Reads your properties, class constants, visibility and static attributes
- Reads your functions, with parameters, default values, and types (when stated)
- Reads your comments : class docblocks (@package), function docblocks (@param and @return) and file docblocks (@package)
- Reads the new PHP instruction "namespace" (simple, non-hierarchical expressions only at this time)
- Can bind classes to artifacts (through UML2 manifestations)
- Automatically detects data types, through the default values
- Generates UML version 1.4, and version 2.1

How do I use it ?
You just need to run a couple of instructions in a PHP page: you create a PHP_UML object, you specify the location of the directory to parse, which version of UML/XMI you want, et voilà.
» Dependencies » Links
» Timeline » Changelog
  • First Draft: 2008-03-05
  • Proposal: 2008-04-08
  • Call for Votes: 2008-04-28
  • Baptiste Autin
    [2008-04-25 22:54 UTC]

    - Dispatched the code into several subdirectories ("Metamodel" for the EMOF and utility classes, "PHP" for the parser class, and "XMI" for the XMI factory classes)
    - Added a PHPUnit regression test.
    - Modified the API so it is now possible to generate XMI via the API (without using the PHP parser) : see the example
    -> this, I hope, will allow better integration with other PHP packages.
    - Added a deployment view, using UML artifacts (classes can now automatically be linked to the files where they are defined)