Extension

Extension – How to extend PHP_UML?

Extension

PHP_UML is designed with evolution in mind. By choosing XMI as the pivot format for representing the program's structure (namespaces, classes, functions...), PHP_UML can not only interface with design tools, it can also produce other output formats, via XSL transformations (this is how the format "html" is generated).

If you only need to customize a bit the look and feel of the HTML doc, just modify the stylesheet (in /UML/Output/html/resources/style.css).

But if you need deeper changes, you will have to create your own XSL transformation. For that, start with a new folder under /UML/Output/, and put a main.xsl file inside (you can copy the one in /Output/html/). Write all your XSLT stuff in main.xsl, or split it among multiple template files (that's how PHP_UML does). Then run the method export("newFormat", "."), by passing the name of your transformation as the first parameter.

Instead of transforming XMI code, another way to create additional output formats is to program a process that exploits the metamodel that the parser has built. This is how the exportation formats htmlnew and xmi work. If you want to write your own format, you will have to program your own implementation class of PHP_UML_Output_ExporterAPI, and put it into a new folder, under the folder Output (beside the folders HtmlNew and Xmi).

For a better understanding of the program's guts, see its class diagram, available in the docs folder (PHP_UML_simplified_class_diagram.png).

If you are interested by the PHP_UML project, and want to participate, do not hesitate to contact me.

How to use PHP_UML from its API? (Previous) PHPUnit (Next)
Last updated: Sun, 29 Aug 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.