I found this useful page for counting lines in projects that I work on.

There are a couple of different techniques there, but I personally use the following:

find . -type f -name '*.php' | xargs wc -l