Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Pfff:PHP

pad edited this page Oct 14, 2020 · 1 revision

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.

To visualize a PHP project using codemap you first need to analyze it with codegraph:

$./codegraph -lang php -derived_data -build /path/to/php/project/

This should process all files and at the very store the global analysis results in /path/to/php/project/PFFF_DB.marshall`. 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:

$ ./codemap /path/to/php/project/

The tool will by default [1] look for a PFFF_DB.marshall 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.marshall
Using Cairo version: 1.8.10
We got 1791 entities in 243 files
...

See CodeMap for more information.

To perform some PHP refactorings see Spatch.

[1] You can also use the -with_info option if you decided to store the light database in a non-default location.
Clone this wiki locally