Home arrow PHP arrow Handling Cookies and File Data with the Factory Pattern in PHP 5

Handling Cookies and File Data with the Factory Pattern in PHP 5

Any PHP developer who has been using the object-oriented paradigm for a while for developing web applications knows that the factory design pattern can be really useful when it comes to creating multiple objects across a specific programming context. However, if you're interested in filling some knowledge gaps that you might have about this handy pattern, then this article is possibly what you're looking for.

  1. Handling Cookies and File Data with the Factory Pattern in PHP 5
  2. Saving data using cookies and text files
  3. Creating some data saving classes
  4. Seeing the factory pattern in action
By: Alejandro Gervasio
Rating: starstarstarstarstar / 8
July 02, 2007

print this article




Welcome to the second tutorial of the series that began with "Using the Factory Pattern in PHP 5." Made up of three instructive parts, this series walks you through the foundations of developing factory classes with PHP, and also shows you how to implement this popular design pattern in real world situations.

Now, having properly introduced the subject of this series, let me touch upon what was covered in the preceding article to refresh your memory. As you'll probably recall, I demonstrated in a friendly way how to build a pair of concrete factory classes. These came in useful for spawning different array-processing objects in accordance with the specifications of their corresponding contexts.

Of course, defining the aforementioned factory classes was merely an introduction to exploring the remarkable functionality provided by the homonymous pattern, and it should be admitted that there are many other cases in which the pattern can be used successfully. Nevertheless, I do think that all the hands-on examples shown in the first article of the series were explicit enough to illustrate how a concrete factory class works and how it can be called statically within a specific programming environment.

So far, so good right? At this stage you should have a more accurate idea of how to include the factory pattern into your own PHP applications, at least at a very basic level. But don't you worry because this scenario is going to change quickly, since in this second tutorial I'm going to teach you how to take advantage of the capacity offered by the pattern to create objects that are capable of saving data to different locations, including files and cookies.

Hopefully, this experience will be educational and serve to expand your existing skills on pattern-based programming with PHP 5 even more.

So, are you ready to start reading? Let's go!

>>> 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: