FW: Proposal for a new package : PHP_XMI
| From: | Baptiste Autin | Date: | Sun, 02 Mar 2008 03:22:02 +0000 |
| Subject: | FW: Proposal for a new package : PHP_XMI | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-49217@lists.php.net to get a copy of this message | ||
Hello,
I have developed a package that generates XMI code from PHP files and
directories.
Reminder: XMI is an OMG standard used to import/export data to/from UML
designer tools.
So it's a kind of PHP reverse-engineering package, quite useful if you need
to have a global view of all your classes, to document your code, to print
class diagrams, to convert programs from PHP to another language, etc.
It is a complement to PHPDocumentor.
My package scans the directories, analyzes the PHP files, and produces a
global XMI file that you can import into your favourite software designer,
like Rational Rose, ArgoUML, Umbrello, or Protégé.
Like PHPDocumentor, it reads classes, properties, functions, parameters of
functions, visibilities, inheritance, and so on. It can also interpret the
javadoc-like comments to get extra information about packages (@package),
and parameter / return types.
It understands the new "namespace" PHP instruction, but it cannot deal with
the hierarchical double-colon writing (like A::B) - this is a TODO.
It scans PHP 4 or 5 code.
It generates XMI 1.3, and XMI 2.1 (XMI 2.1 compliancy is rudimentary, but
enough for importing into the UML soft "Bouml").
However, it won't work with the UML Eclipse Plug-in (which uses a particular
XMI2 flavour, called "ecore").
Now, the flaws.
1. It is not the fastest parser you'll ever see. It took 13 minutes on a P4
3GHz to scan a 36Mo folder of PHP libraries... (but it went through !)
2. The code is a bit tricky sometimes, and not the simplest you'll meet: XMI
is a standard which turns out to be more cryptic than standard... and not
interpreted in the same way everywhere. Moreover, a PHP parser is not easy
to write; I did what I could.
PHP_XMI doesn't depend on the PEAR PHP_Parser package. First, because I
wanted to look into the comments too (the function comments, the class
comments, the page comments) and PHP_Parser ignores them. And second, more
annoying, PHP_Parser doesn't care with packages nor namespaces.
Now, I have a stupid question:
How can I quickly generate the <contents><dir><file> part of package.xml
(especially the md5sum) ? I couldn't find anything in the documentation
about it.
Thanks.
Baptiste Autin