PHP 调用图实用程序?

发布于 2024-07-30 10:30:25 字数 1539 浏览 6 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

晒暮凉 2024-08-06 10:30:25

我肯定会尝试 Doxygen。 它支持 PHP,它创建的调用图和调用者图对我之前探索“外国代码”非常有用。

doxygen 调用图示例

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.

Example of doxygen call graph

静赏你的温柔 2024-08-06 10:30:25

不确定是否有任何东西可以分析用 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

傲影 2024-08-06 10:30:25

如前所述,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.

焚却相思 2024-08-06 10:30:25

如果您需要一些交互式内容,请查看新的 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文