HomePHP Controlling Online Forms with Builder Objects in PHP 5
Controlling Online Forms with Builder Objects in PHP 5
Mastering some of the most popular design patterns with PHP 5 can be sometimes an overwhelming process that requires hard work and experience. However, if you want to tackle the challenge and expand your existing background on them, this article might eventually find a place on your quick reference list.
This is the second part of the series "How to use builder objects in PHP 5." Made up of three tutorials, this series introduces the basics of working with directors and builders with PHP, and teaches you how to use them in real-world environments.
One of the most interesting aspects of working with design patterns that fall under the creation category rests on understating the different relationships that can be defined between two or more objects to build a third one. That's exactly the logic that stands behind using directors and builders. That concept was deeply covered in the first article, when I set up an introductory example for generating basic XML pages.
As an useful reminder, allow me to explain quickly what I mean when I talk about using directors and builders. In short, these two types of objects are used in conjunction to build another one via a well-defined behavior. This behavior is defined as follows: first, the builder is responsible for creating the target object, while the director, as its name implies, establishes what specific parts of the third object should be included in the creation process. Does this definition sound familiar to you? I hope it does.
Okay, once the key concepts surrounding the implementation of the builder pattern with PHP have been properly grasped, it's time to leap forward and continue learning more hands-on examples. Specifically, in this second article of the series, I'll go deeper into the topic and show you how to use both directors and builders to construct and control programmatically online forms.
Having established the goals of this article, let's jump straight into the subject and find out how web forms can be created by using the builder pattern. Let's get going!