News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

DevShed:
Building Concrete Validators
December 22, 2011 @ 11:24:25

On DevShed.com today there's the first part of a two-part series showing how to build self-contained validator objects that can be used to test the format of user input for validity.

In this two-part tutorial, I show why the use of static helper classes can be detrimental to building robust and scalable object-oriented applications in PHP (though you should take into account that the concept is language agnostic). I also implement a set of instantiable, fine-grained validators, which can be easily tested in isolation, injected into the internals of other objects, and so forth.

Their set of "concrete validators" are all based off of a validator interface/abstract class and check things like email formatting, floats, integers and URLs. Also included are a few examples of using the validators in a sample script.

0 comments voice your opinion now!
validator tutorial test data interface abstract class


blog comments powered by Disqus

Similar Posts

Chris Hartjes: 5 Minute TDD

NETTUTS.com: Top 15+ Best Practices for Writing Super Readable Code

Kevin van Zonneveld's Blog: How virtualization will improve your code

MaltBlue.com: \Zend\Db\Sql - Creating Joins and Unions with Ease

MaltBlue.com: Zend Form Mastery with Zend_Config - Part 2, Core Form Configuration


Community Events





Don't see your event here?
Let us know!


community interview framework developer refactor podcast introduction opinion laravel release install code language threedevsandamaybe unittest testing list wordpress configure series

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework