When reading other people's code without detailed documentation, how to quickly see the entire code structure (class structure) becomes a real problem. Today, I will introduce a method for automatically generating UML diagrams. Suppose I have a project folder: icultivator, which has a file Root. php (in fact, no matter how many levels of directories, multiple files can be used ). & Lt ;? Phpabst
When reading other people's code without detailed documentation, how to quickly see the entire code structure (class structure) becomes a real problem. Today, I will introduce a method for automatically generating UML diagrams.
Suppose I have a project folder: icultivator, which has a file Root. php (in fact, no matter how many levels of directories, multiple files can be used ).
First, we need to use PHP_UML (PHP_UML) to generate XMI based on the code.
The usage is relatively simple. after installing PHP_UML, run:
phpuml icultivator/ -o icultivator.xmi -n icultivator?-f xmi --pure-object --no-deployment-view --no-component-view --no-docblock
You will get an icultivator. xmi file. you can learn the specific parameters of phpuml through phpuml-help.
With xmi, how can we convert it into a UML diagram?
Visio2007 does not support importing XMI. I found another tool: Altova MapForce, which supports conversion from XMI to UML diagrams and needs to be registered, however, a 30-day license is provided (if you have a better replacement solution, please add it ).
After Mapforce imports icultivator. xmi, a UML diagram is generated and the following PNG is obtained:
Is it convenient?
In addition, PHP_UML can also generate html format. it is also good to use a doc gen tool. you can also use xmi to generate php files.