我可以使用什么工具为我的应用程序生成 PHP 类使用情况报告?

发布于 2024-08-02 21:03:01 字数 189 浏览 4 评论 0原文

我有一个相当大的面向对象的 php 5 项目,作为变更影响分析的一部分,我想编写一份关于整个项目中每个现有类的使用情况的报告。

如果我能找到一个现有的工具来分析项目中的所有文件并生成某种报告,其中列出了例如为项目中每个类实例化的对象的所有类名,这将对我有很大帮助,并允许我至少可以轻松快速地进行搜索。

如有任何帮助,我们将不胜感激!

I have a fairly large object-oriented php 5 project, and as part of a change impact analysis, I'd like to compile a report on the usage of each existing class throughout the project.

It would help me immensely if I could find an existing tool that will analyze all the files in my project and generate some sort of report that lists, for example, all the class names of objects instantiated for each class in the project, and allow me to at least search this easily and quickly.

Any help here would be appreciated!

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

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

发布评论

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

评论(4

旧故 2024-08-09 21:03:01

查看 nWire for PHP。它分析您的代码并识别此类关联。它是作为交互式工具而不是报告工具构建的,但是,如果您坚持,您仍然可以连接到其数据库(它使用 H2,与 SQL 兼容)并使用外部报告工具。

Check out nWire for PHP. It analyzes your code and recognizes such associations. It is built as an interactive tool, not as a reporting tool, but, if you insist, you can still connect to its' database (it uses H2, which is SQL compatible) and use an external reporting tool.

才能让你更想念 2024-08-09 21:03:01

IMO Zend 有一些分析工具可以做到这一点,或者您可以从他们的加速器日志中推断出此信息。

或者使用 XDEBUG 尝试这个

IMO Zend has some profiling tools that do just that, Or you can extrapolate this information from their Accelerator log.

Or try this with XDEBUG

寒冷纷飞旳雪 2024-08-09 21:03:01

Xdebug 可以跟踪您的代码并创建代码覆盖率统计信息。还有其他工具,例如 Spike PHPCoverage,可以生成格式良好的报告,但由于这些是用于测试覆盖率,它只会给你一个布尔结果(例如,使用或不使用代码行)。您可能需要更详细的视图(例如,使用了多少次)。

另一种选择是使用 Xdebug 的函数跟踪功能。这将为您提供实际调用图的详细报告。您可以从中确定哪些文件使用最多。您需要手动为数据编写一个解析器,但这应该不会太难。

最后,您可以使用静态调用图做同样的事情。有一些可用于 php 的工具。以下是一些:

同样,您可能需要对这些工具的输出进行一些额外的手动解析,以获得适用于您的用例的内容。

Xdebug can trace your code and create code coverage statistics. There are additional tools like Spike PHPCoverage, which can generate nicely formatted reports, but since these are intended for test-coverage, it'll just give you a boolean result (eg. line of code is used or not used). You probably want a more detailed view (eg. how many times is it used).

Another option is to use the function trace feature of Xdebug. This will give you a detailed report of the actual call graph. You can determine which files was used the most from this. You'll need to write a parser for the data manually, but that shouldn't be too hard.

Finally, you could do the same thing with a static call graph. There are some tools available for php. Here are a few:

Again, you probably need to do some additional manual parsing on the output from those tools, to get something that applies to your use case.

安稳善良 2024-08-09 21:03:01

Particletree 中的聪明人,功能美观Wufoo 经常发布和发布他们的 PHP 工具集和实用程序,其中最新的是他们的 PHP 快速分析器。正如你可能知道的那样,我非常尊重这些人并且喜欢他们所做的事情。

一个好的 PHP 分析器通常很难找到,PQP 无疑是我遇到过的最好的。也就是说,几乎所有的 各种 应用程序 框架有某种形式的分析系统,无论是简陋的还是其他的,但都没有那么接近与 PQP 一样深入且有帮助。但是,我通常发现框架分析工具更多地自动链接到代码中,如果您使用框架的标准库,那么您将需要使用分析工具执行更少的实现(这绝对是 CodeIgniter)。但如果您想要额外的功能和灵活性,PQP是很棒的选择。

如果您发现更好的东西,请告诉我 - 我很乐意看到它!

杰米

The clever guys at Particletree, the same people behind the functionally and aesthetically gorgeous Wufoo often publish and release their PHP toolsets and utilities, the most recent of which being their PHP Quick Profiler. As you can probably tell, I have a huge amount of respect for those guys and love the stuff that they do.

A good PHP profiler is often hard come by, and PQP is most certainly the best I've come across. That said, nearly all of the various application frameworks have some form of profiling system, humble or otherwise, but none as nearly as in-depth and helpful as PQP. However, I usually find that the framework profiling tools are more linked into the code automatically, and if you use the framework's standard libraries then you'll have to do a lot less implementation with the profiling tool (this is definitely the case with CodeIgniter). But if you want that extra bit of power and flexiblity, PQP is great.

Let me know if you find anything better - I'd love to see it!

Jamie

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