有没有PHP代码可视化工具?
寻找能够分析 php 代码(即所有 wordpress 或主题)并向我展示漂亮图片的软件(也许是 框图)所有连接,以帮助我更快地了解事物的位置以及事物之间的联系。
理想情况下,这个软件可以在 Mac 上运行,但我会选择任何东西:Windows、Linux、基于网络的等等。
Looking for software that will analyze php code (i.e. all of wordpress or the thematic theme) and show me pretty pictures (perhaps a block diagram) of all the connections to help me more quickly get an understanding of where things are and what's connected to what.
Ideally, this software would run on a Mac, but I'll take anything: Windows, Linux, web-based, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
[更新:这个答案不处理名称空间,所以基本上已经过时了。我将把它留在这里,以防有人觉得 DOT 方法有趣。]
这是在 PHP 中绘制类继承图的简单方法。
Grep 查找类定义,然后将 grep 输出转换为 DOT 语法。注意:此过程需要根据您的情况进行反复试验。单独运行 grep,并在将其放入脚本之前对其进行调整以显示正确的类定义行!
该脚本适用于标准 *nix(我使用 Ubuntu)上的 PHP,安装了 graphviz,并使用 grep -v 排除一些不感兴趣的目录,因为我正在查看 CakePHP 代码库。在这种情况下,Fdp 比 sfdp、dot、circo 或 neato 效果更好。
创建generateClassHierarchy.sh
然后只需:
将eog 替换为您喜欢的图像查看器。我已经在 Zend Framework 上运行这个作为测试,并生成了一个 22 MB 的 PNG 图形。仅在 Zend_Db 上运行它会向您显示以下内容(示例位于我的网站上):
http://chapman.id.au/generate-php-class-inheritance-diagrams-in-graphviz
[UPDATE: This answer does not handle namespaces, so is basically obsolete. I'll leave it here in case anyone finds the DOT approach interesting.]
Here's a simple way to graph class inheritance in PHP.
Grep for class definitions and then transform the grep output to DOT syntax. NOTE: This process WILL require trial and error in your situation. Run the grep separately, and tweak it to show the right class definition lines before putting it in the script!
This script was for PHP on standard *nix (I used Ubuntu), with graphviz installed, and using grep -v to exclude some directories that were of no interest because I was looking at a CakePHP codebase. Fdp worked better than sfdp, dot, circo or neato in this situation.
Create generateClassHierarchy.sh
Then just:
Replace eog with your preferred image viewer. I have run this on Zend Framework as a test, and produced a 22 megabyte PNG graph. Running it on just Zend_Db shows you this (example is on my site):
http://chapman.id.au/generate-php-class-inheritance-diagrams-in-graphviz
也许 http://phpcallgraph.sourceforge.net/ 用于静态分析。
它可以输出为各种格式。
Maybe http://phpcallgraph.sourceforge.net/ for static analysis.
It can output to various formats.
BOUML 可以用现有的 PHP 代码制作 UML 图
BOUML can make UML diagrams out of existing PHP code
nWire 已过时,不支持最新的 PHP 版本(命名空间)。
Visual Paradigm 的社区版本对于非商业项目是免费的,但在最新的 PHP 版本上也失败了。
phUML 是非常有用的免费工具,它不再维护,但仍然可以很好地用于 PHP 5。Mac 用户应安装graphviz 也是如此。
nWire is outdated, does not support latest PHP versions (namespaces).
Community version of Visual Paradigm is free for non commercial projects, but fails on latest PHP versions too.
phUML is very useful free tool It's not maintained anymore, but still works fine for PHP 5. Mac users shall install graphviz too.
尝试
JB Graph
如果您擅长 java 脚本,请尝试 D3.js
Try
JB Graph
if you good in java script then try D3.js
https://d3js.org/