views:

33

answers:

1

I need to list all PHP extensions that's required by a given code base. What would be the best way to tackle this problem?

My initial thought is to write a script that goes through all files and find all functions and compare them to a given extension/function database. Any other suggestions?


Update: I already did some Bash script with grep and using get_loaded_modules, get_extension_funcs PHP functions, but this extension is exactly what I was looking for.

+1  A: 

There is a PEAR package that does that, from what I remember : PHP_CompatInfo :

Find out the minimum version and the extensions required for a piece of code to run

See The Command-Line Parser to know how to run it from the Command Line, and to get some examples of output.


(It's marked as not maintained anymore, so there might be some troubles with recent versions of PHP, but last time I used it -- maybe one year ago -- it worked fine)

Pascal MARTIN