API – How to use PHP_UML from its API?


PHP_UML is structured in 4 packages:

  • The host package, which contains the main class (PHP_UML) and some utility classes

  • The Input package, where the PHP parser resides

  • The Metamodel package, which contains the data structures that PHP_UML is using to modelize the code parsed

  • The Output package, which contains all the stuff to transform a metamodel stored into memory into an output format (like XMI, HTML, or PHP)

Unless you want to develop your own output format, the only single class you need to know about is PHP_UML. Since the first release of PHP_UML, the API of that class has changed, and you might find several methods doing more or less the same job.


Parsing of a single file test.php, and generation of its XMI file:

require_once 'PHP/UML.php';

$uml = new PHP_UML();   
$uml->parse('foo');           // parses, and sets the name of the root package
$uml->generateXMI(1);         // generates XMI in version 1

Parsing of two directories, ignoring the CSV folders, and generation of HTML documentation

require_once 'PHP/UML.php';

$uml = new PHP_UML(); 

Import of an XMI file, and generation of PHP code templates

require_once 'PHP/UML.php';

$uml = new PHP_UML();   
Things to know about how PHP_UML parses PHP code (Previous) How to extend PHP_UML? (Next)
Last updated: Sun, 19 Dec 2010 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report or add a note.
View this page in:

User Notes:

There are no user contributed notes for this page.