Home arrow PHP arrow Developing a Form Validation System with the Observer Pattern in PHP

Developing a Form Validation System with the Observer Pattern in PHP

Want to gain a good grounding in how to apply the Observer pattern in PHP? Then you’re in the right place! Welcome to the second part of the series “The Observer Pattern in PHP.” Composed of three tutorials, this series teaches you the key concepts of the popular Observer design pattern, and shows you how to apply it in the context of real-world PHP applications.

  1. Developing a Form Validation System with the Observer Pattern in PHP
  2. Validating input data: constructing some useful data validation classes
  3. Extending the scope of data validation: defining some additional data checking classes
  4. Getting the whole picture: listing the full source code for the data checking classes
By: Alejandro Gervasio
Rating: starstarstarstarstar / 9
July 24, 2006

print this article




Okay, after introducing the topics treated over the course of this series, let’s quickly recapitulate the concepts that I deployed in the first tutorial so you can understand this second article more easily.

As you’ll hopefully remember, in the previous part I went through the implementation of the Observer pattern in PHP 5 by coding a basic example. The example demonstrated in an easygoing fashion how the different objects that make up a specific program can be decoupled from the rest of the application, in this way clearly delineating their scope.

Regarding this particular example, the implementation of the Observer pattern allowed me to develop a message handling system capable of reflecting certain changes generated by independent objects at the application’s core level. Indeed, the application of this pattern is one of the best approaches available today for constructing truly independent objects, as well as building systems that expose a centralized mechanism for making decisions according to the changes introduced by disparate components.

Well, after refreshing some of the most important points regarding the creation of observer objects, let’s focus our attention on the subject of this second tutorial. Over the next few lines, I’ll be demonstrating how to apply the Observer pattern during the development of a real-world application: a form validation system.

Based on this approach, hopefully you’ll learn quickly how to validate input data by using the Observer pattern. Are you interested in learning how this can be achieved with PHP? Fine, start right now reading the next section!

>>> More PHP Articles          >>> More By Alejandro Gervasio

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: