sike — 2004-04-26T14:39:23-04:00 — #1
while playing around with the new object model of php 5 i discovered the
mighty reflection api. to explore its complete power i decided to write
a simple XMI generator (XMI is used by most UML tools for im/exporting diagrams).
i must admit i am impressed : i took me only 3-4 hours to get the
export stuff working. at the moment it only exports classes and interfaces but it is imho a very handy tool for getting an uml view on projects (see attachment). anyone interested in completing such a tool?
system — 2004-04-26T14:43:44-04:00 — #2
Sorry, but way above my current skills Never really got a hold of UML.
The problem being for me at the moment is I see it as being wasteful of my time as I have no real need to use it just now
But be interesting to see how things develop though
nucleuz — 2004-04-26T16:35:18-04:00 — #3
Interesting, very interesting. I don't know about completing it, but I would defenently like to see the code. This could be a good tool to get a quick overview of a class library. Played with a similar tool last year on a large app in C# and it was defenently a good help.
resolution — 2004-04-26T16:48:41-04:00 — #4
Brilliant! I was just viewing WACT's documentation and even saw a request for someone to transform the current model into UML, and thought if it could be done automated.
Brilliant! Took the words ..err.. diagram right out of my mind. Are you going to try and start a project for an automated XMI/UML tool?
PS: Here is the specification for XMI for all those wondering. http://www.omg.org/technology/documents/formal/xmi.htm
resolution — 2004-04-26T16:58:51-04:00 — #5
sike — 2004-04-26T17:10:51-04:00 — #6
just cleaned some things up and zipped all files.
you will need php5 and mysql4 to run the scripts and
poseidonCE or any other xmi 2.0 capable editor to import
the xmi and create diagrams from it.
edit parse_source.php and generate_xmi.php for database settings.
parse_source : will persist all classes to mysql with REPLACE
generate_xmi : transforms persisted data into xmi v2.0 files : xmi.xmi and xmi.xml
ps. i am not shure if this really is xmi2 but poseidon claimed it (;
sike — 2004-04-26T17:11:58-04:00 — #7
yep. but as far as i remember i had problems with its ugly output (:
resolution — 2004-04-26T18:27:33-04:00 — #8
Thank you sike.
I got the classes functioning and an XMI file was output but there was no class data for poseidon.
Can you rewrite the direcitons less compact, mabey I missed a step because my datbase is not populated with ANY data!?
Ok. Interesting project, look forward to seeing how it works.
PS: Take a look at the XMI and XML file I get as output
nucleuz — 2004-04-26T18:45:29-04:00 — #9
Played with it, had to fix the class names for the reflection classes though: ReflectionClass instead of Reflection_Class ( latest CVS ), other than that it worked like a charm.
Attatched is a quick test with some of the cowiki classes through poseidon.
sike — 2004-04-26T19:01:08-04:00 — #10
oh well looks like they changed all reflection classes names...
i'll try rc2 and fix all code necessary tomorrow (:
resolution — 2004-04-26T23:09:28-04:00 — #11
Ok I tryed it and got it to work.. AWESOME!
I decided to get ambitious as do something like say WACT. I used one of the example called BLOCK.php with the program sike has so generously offered and then used posiden to depict the image. You wact guys might get happy about this picture.
It shows a compile in progress, so HTMLSax's classes are also loaded and diagrammed. This is goiing to be tool of the year. Awesome!
PS: The Zip is a posiden CLASS UML file of the whole scenario.. So you only need posiden to view it - if you don;t have php5 and the program set up! Check it out.
sike — 2004-04-27T04:37:01-04:00 — #12
hehe nice picture resolution. can't see that much but it shows
the tool does its job (:
i am currently adjusting stuff to rc2 and impementing properties to show up in the diagrams..
sike — 2004-04-27T06:24:50-04:00 — #13
ok here is the new zip. cleaned some things up a bit and added properties.
sike — 2004-04-27T07:16:54-04:00 — #14
while working with the uml view on my project i realized that
using packages would improve readability so i implemented it (:
this will work only if you use DocBlocks with @package tags.
same for variable types (@param).
nucleuz — 2004-04-27T08:21:45-04:00 — #15
Nice, will look at it tonight.
One thing: how about implementing a couple of const when generating the xmi:
XMIWriter::CLI = 1;
XMIWriter::BROWSER = 2; // default
$xmi->setEnv( XMIWriter::CLI );
I use tools likt this in the terminal, and getting lots of html tags there doesn't do much good.
Maybe a function:
private function status( $msg )
if( $this->isCli() )
echo $msg . "\
echo $msg . "<br />";
then use that function to print the message depending on where you are executing the file. ( I'll implement this later tonight when I get off work if you don't want to do it )
sike — 2004-04-27T09:00:38-04:00 — #16
good point. never used cli but i will try to implement this feature
sike — 2004-04-27T09:18:42-04:00 — #17
easy enough... i just used follwing code (stolen from an older thread) for checking if we run in cli mode :
$this->cli = (php_sapi_name() == 'cli') ? true : false;
mat_taylor — 2006-06-07T08:35:22-04:00 — #18
Sike, I've just been using your php2xmi script and it works really well, great! Have you been developing it any further since your last post?
I've just come across this which may be of interest to people
galo — 2006-06-07T17:54:52-04:00 — #19
that's just sick, nice work ....
cysin — 2006-06-11T00:28:18-04:00 — #20
next page →