Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(5)
我肯定会尝试 Doxygen。 它支持 PHP,它创建的调用图和调用者图对我之前探索“外国代码”非常有用。
I would definitely try Doxygen. It has support for PHP, and the call graphs and caller graphs it creates have been very useful in exploring "foreign code" for me previously.
不确定是否有任何东西可以分析用 PHP 编写的源代码来生成它......但是当您运行代码时,有一种可能性。
您可能想看看 Xdebug 扩展:它带来了 Xdebug 扩展。 org/docs/profiler" rel="nofollow noreferrer">分析 到 PHP,并生成类似 callgrind 的文件,可以使用 Linux 上的 KCacheGrind。
这个能够生成某种调用图。
它还可以与PHPUNit集成,生成代码- 运行单元测试时的覆盖率
前段时间,PHPUnit 能够使用 graphviz 生成一些调用图; 不过,我再也找不到这个选项了:-(
编辑:这是我第一次听说它,但是有一个名为 phpCallGraph 也可能对您有帮助...并且似乎正在开展工作,如果我查看它的 变更日志
Not sure there exists anything that can analyse source-code written in PHP to generate that... But there is a possiblity, when you are running the code.
You might want to take a look at the Xdebug extension : it brings profiling to PHP, and and generate callgrind-like files, that can be read with KCacheGrind on Linux.
And this one is able to generate some kind of callgraphs.
It can also be integrated with PHPUNit, to generate code-coverage when running unit-tests
Some time ago, PHPUnit was able to generate some callgraphs with graphviz ; I don't find that option anymore, though :-(
EDIT : it's the first time I hear about it, but there is a project called phpCallGraph that might be able to help you, too... and it seems there is work going on, if I look at it's changelog
如前所述,Doxygen 可以生成调用图。
Xdebug 可以生成函数跟踪。 它们与 doxygen 的图表不同,因为它们是从运行时代码生成的,而 doxygen 是静态生成的。 我不知道有什么工具可以将函数跟踪转换为视觉表示,尽管这应该不难做到。
还有 bytekit 扩展,其主要功能是显示 php 源代码将生成的字节码。 它可以在图表中显示这一点,这本质上是一个调用图。
As noted already, Doxygen can generate call graphs.
Xdebug can generate function traces. These differ from doxygen's graphs in that they are generated from runtime code, whereas doxygen is generated statically. I don't know of any tools that can turn the function traces into a visual representation, although it shouldn't be that hard to do.
There is also the bytekit extension, which primary function is to show the bytecode that php source code will generate. It can show this in a graph, that is essentially a callgraph.
这是一个老话题 - 但万一有人发现它有用......
kKCachegrind 将生成显示实际执行线程的调用图。
PHPCallGraph 是一个相当简单的 graphviz,它执行静态分析
还有 我自己的努力 与 PHPCallGraph 类似,但添加了有关循环/条件的信息结构并提供向节点添加回调的方法。 一些示例脚本与工具包捆绑在一起 - 但您也可以将其嵌入到您自己的脚本中。
This is an old topic - but in case anyone finds it useful....
kKCachegrind will produce callgraphs shown the actual execution threads.
PHPCallGraph is a fairly simple around graphviz which perfroms static analysis
There's also my own effort which is similar to PHPCallGraph but adds information about loops/conditional structures and provides a method for adding callbacks to nodes. Some example scripts are bundled with the toolkit - but you can also embed it in your own scripts.
如果您需要一些交互式内容,请查看新的 nWire for PHP。 它是一个 Eclipse 插件,可与 PDT 2.1 和 Zend Studio 7.0 配合使用。
If you need something interactive, check out the new nWire for PHP. It is an Eclipse plugin which works with either PDT 2.1 and Zend Studio 7.0.