What is Q-Validate?For some time now, I've been very unsatisfied with the state of validation libraries in PHP. For the most part, you can't really even find a simple validation library. The few decent ones I have found have been coupled to a form library such as "HTML_QuickForm"
... [More]
or "Zend_Form". In my opinion, forms are much too complex and important to depend on a form generator. My forms don't tend to follow a repetitive enough structure to allow the use of any of these options. Zend_Form is a bit different in that it allows you to add "decorators" that can render its elements exactly how you want them, but what I don't understand about this approach is that it's more complicated than simply writing the HTML yourself.
Furthermore, forms aren't the only data that ever needs to get validated. What if I simply want to validate an array of data? There are no good options out there for this. At least not that I know of. My solution is Q-Validate.
Some HistoryWay back in August of '06 I was in search of a library to ease the task of validating forms in PHP. I gained some valuable insight into form validation, but ultimately went away from that thread unsatisfied.
About a year later (September '07) I was just starting to learn how to write applications with the Zend Framework (and with PHP in general). I was pretty happy with Zend as a whole, but one area where I just wasn't happy was Zend_Validate and Zend_Filter. They required that you validate values one at a time. You couldn't chain validation rules and filters together. To me, this was unacceptable, so I wrote a little library called MC2_Validate (you can see the thread that started this library here). While it was closer to my vision of how forms (and any other kind of data) should be validated in PHP, it was still rather clunky to use, as I wasn't necessarily experienced enough to write a library at that time. I ended up throwing it in the trash after using it for a few projects.
Several months later, I was still fed up with forms libraries, and vented my frustration in another DevNetwork thread. At this point I was ready to just give up on PHP completely. I was just sick and tired of not having a good solution to form/data validation. In this thread I finally managed to spark up some interest on the issue and a few of the senior members and myself began discussing just what made forms libraries suck so bad, which in turn lead to this discussion, and ultimately the rewriting of the filter/validation components for the Skeleton Framework, a friend's project that's been in the works for years.
Most of the concepts for Q-Validate came either from MC2_Validate (which is history) or the Skeleton Framework's A_Rule and A_Filter components.
Where the hell are the docs??With the first release of this library, I apologize, but I do not have any documentation. The working documentation (incomplete for now) is below:
Working Docs [Less]