WordPress.org

Ready to get started?Download WordPress

Plugin Directory

PHP Validator

PHP Validator is a pseudo-compiler for PHP to help developers locate undefined functions and methods.

PHP Validator is a developer tool. It scans the file you specify and determines whether you have undefined functions or methods.

Why not just run the PHP code, you say? Well, PHP is not a compiled language. It looks for functions during runtime. So if you have a segment of code not covered by your normal testing, and you have an undefined function in there, you will never know of the undefined function until it hits production when the particular conditions activating that particular code segment are met.

In my case, in one of the projects I was working on (Easy PayPal, soon to become a WordPress plugin), I had a few include files defining functions in the global scope. I wanted to refactor them into three different classes and edit my ten or so source files the add $class-> wherever necessary. Careful and systematic though I am, I kept missing a few function calls. Finally I got everything working. But I always had this fear that there were code paths that I may have missed, and there will be nasty surprises down the line, since the package is fairly complex and my test coverage is far from 100%. I thought it was silly to rely on tests to detect what in all other languages would be obvious compilation errors. So I started looking for compilers. I found some, but could never get any one of them work. So I decided to write a tool myself, which I named PHP Validator. I am happy to say that I managed to find a few undefined functions and methods (that I would have otherwise missed) using this tool.

Pro Version

PHP Validator is released as a Lite version here. It is fully functional and will locate all the undefineds as the Pro version. In the Pro version, it will also list the line numbers at which the undefined function occurs, which may make it a bit easier to locate. Also available is a Stand-alone version that runs as an independent browser-based tool.

Requires: 2.5 or higher
Compatible up to: 3.8.3
Last Updated: 2014-3-25
Downloads: 1,477

Ratings

5 stars
5 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1
100,1,1