Automatic generation of class diagrams from PHP source code
Create PHP class diagrams with images in PHUML
It seems that PHPSTORM has a function to create class diagrams, but PHPSTORM is not included in the home environment, so I was looking for a tool that automatically generates class diagrams and found a tool called phuml. The environment is Ubuntu 18.04LTS.
https://github.com/jakobwesthoff/phuml Let's download it from and deploy it to a suitable location. I expanded it to ~/.local as phuml. You can now run it.
$php ~/.local/phuml/src/app/phuml phUML Version 0.2 (Jakob Westhoff <[email protected]>) Usage: phuml [-h|-l] [OPTIONS] <DIRECTORY> <PROCESSOR> [PROCESSOR OPTIONS] ... <OUTFILE> Commands: -h Display this help text -l List all available processors Options: -r Scan given directorie recursively Example: phuml -r ./ -graphviz -createAssociations false -neato out.png This example will scan the current directory recursively for php files. Send them to the "dot" processor which will process them with the option "createAssociations" set to false. After that it will be send to the neato processor and saved to the file out.png
I'm tired of typing every time, so I put a symbolic link on it.
sudo ln -si ~/.local/phuml/src/app/phuml /usr/local/bin
After that, go to the directory you want to analyze and use it in the sample as well.
phuml -r ./ -graphviz -createAssociations false -neato out.png
Just run it and raise it and you're good to go. I tried running it in the src directory of one of the laravel ecosystems.
I was able to display it properly!
都内の製作会社でサーバーサイドエンジニアをしております。主に使っている言語はPHPですがqiitaでは自分の興味のままにいろいろ書いていければいいなと思っております。どうぞ宜しくお願い致します。Updated on September 08, 2020