First I would evaluate which PEAR classes are installed on the system
if you think that some of the Libs used in the project may be missing, you need to download the entire Pear repository locally
To download all packages, do:
pear config-set preferred_state alpha pear remote-list | awk '{print $1}' > tmp-list ; tail -n +5 tmp-list > pear-list ; rm tmp-list cat pear-list | xargs -n 1 pear install
Then, to create a list of all classes:
cd /usr/share/php #( or different path to pear libs ) find . ! -path "*/tests/*" ! -path "*/examples/*" -name "*.php" -type f | xargs grep -Pho "^class ([a-zA-Z0-9_]+)" | sed -e "s/^class //" -e "" > all_pear.txt
This will create a list of all the Pear classes stored in all_pear.txt
Then I would look for all the links in my code
cd my_project; while read line; do find . -name "*.php" -type f | xargs grep -Pho $line; done < path/to/all_pear.txt | sort | uniq > used_classes.txt
This will create a list of all the PEAR classes used in the project and save the list to the used_classes.txt file
source share