Skip to content
This repository has been archived by the owner on Jun 4, 2019. It is now read-only.

Pfff:PHP

pad edited this page Oct 22, 2010 · 19 revisions

Follow the installation instructions in install.txt in the source of pfff. Once pfff is compiled, to search for PHP code patterns simply do for instance:

$ ./sgrep -lang php -e 'false !== error_log(...)' /path/to/php/project/

See Sgrep for more information about sgrep.

To visualize a PHP project using pfff_visual you first need to analyze it with pfff_db_light:

$./pfff_db_light -lang php /path/to/php/project/

This should process all files and at the very end ask for confirmation to store the global analysis results in /path/to/php/project/PFFF_DB.db. Enter "y". This global analysis mostly compute the callgraph of the PHP project to determine which functions or methods or classes are the most used, and so are probably the most important. It also stores which functions are taking arguments by reference or which functions are dead, which is leveraged later by the visualizer.

Once the light database has been saved, simply do:

$ ./pfff_visual /path/to/php/project/

The tool will by default[1] look for a PFFF_DB.db file in the directory of the processed project. It should ouput something like:

...
317 rectangles to draw
Using pfff light db: /path/to/php/project/PFFF_DB.db
Using Cairo version: 1.8.10
We got 1791 entities in 243 files
...
[1] You can also use the -with_info option if you decided to store the light database in a non-default location.

See Pfff_visual for more information.

Clone this wiki locally