views:

161

answers:

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!

+2  A: 

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

Itay Moav
A: 

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

Jamie Rumbelow
He is looking for a class usage report, not a quick profiler. That said, PQP is very nice. Even tough I myself prefer CodeIgniter's default one.
Frankie
+2  A: 

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.

zvikico
nWire did come in very handy, I like some of the views it provides, I figured out how to work with its output.
Gus Melo
Glad you found it useful. We are considering adding some built-in report capabilities along the way. Feedback is always welcome.
zvikico
+1  A: 

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.

troelskn
A: 

I found another alternatives: http://www.fospace.com

Gina Rosales