Wrap the validation functionality in a class

The primary change in this PR is to wrap the functionality in a class. The primary reason for that in turn, is to allow autoloading of the class. It also allows for more fine grained use of the functionality, as well as making it easier to extend in the future.

Because the change to a class is fairly invasive, changes went in all over the place.

As it doesn't make sense to keep the example usage in the same file as the class, I moved that code into a separate file. This required changes to the index.php file, and in the end I decided several files, while useful as examples, were not part of the primary functionality, so I created a doc directory, and moved most files in there.

You would need to modify your vhost appropriately for your demo to keep working in case you accept this PR as is.

For more details, see individual comments below.