Command-line PHP Syntax Checker

Here’s a useful command alias to add to your .bash_profile:

alias phpcheckr='find ./ -type f -name \*.php -exec php -l {} \; | grep -v "No syntax errors"'

This nifty little command recursively traverses all of your directories for php files and runs a syntax check on them. If there are no errors the output is hidden. Enjoy.

Leave a Reply

You must be logged in to post a comment.