Validator package
This package unifies server-side (PHP) and client-side (JavaScript) input validation so you only write the validation logic once and it is used by both PHP & JavaScript. Full documentation is available in the May 2007 php|architect article: Unifying Server-Side and Client-Side Input Validation