You have been writing a lot of PHP code and want to generate statistics about the number of comment and code lines in your application. Maybe you want to generate statistics about some PHP project. You can do it with just one command.
phploc helps you quickly generate numbers about the size of a PHP project.
You can install phploc from the PEAR installer. The PHP PEAR package itself is most likely available from your distribution vendor.
Once you have installed PHP PEAR you have to add the pear.phpunit.de channel.
pear channel-discover pear.phpunit.de
Next step is to install phploc.
pear install phpunit/phploc
Now you should be ready to generate statistics.
Let's run it against Drupal. I have downloaded Drupal and extracted the files in /home/sudheer/download/drupal.
phploc /home/sudheer/localnfs/download/drupal/
The output looks like
phploc 1.1.1 by Sebastian Bergmann. Directories: 15 Files: 63 Lines of Code (LOC): 4697 Comment Lines of Code (CLOC): 2145 Non-Comment Lines of Code (NCLOC): 2552 Interfaces: 0 Classes: 0 Non-Static Methods: 0 Static Methods: 0 Functions: 51
I recently ran phploc against BizSense and published the results at Binary Vibes Blog.
Looking at the results, you can have an overview of how object oriented is your application. The ration of comments to code is often an interesting metric. When you are asked to work on an existing PHP application, running phploc can help you get an overview of the project code base. You can also use it to compare the growth of your application from one version to another.
Generate statistics about your PHP project and let us know how useful is phploc.
Post new comment