Home arrow PHP arrow Using Directory Iterators and MySQL with Adapter Objects with PHP

Using Directory Iterators and MySQL with Adapter Objects with PHP

If you’re a PHP programmer who’s searching for a comprehensive tutorial on how to create adapter classes with PHP 5, them look no further. Welcome to the final installment of the series “Implementing adapter objects with PHP.” Made up of two parts, this series teaches you how to implement the adapter design pattern in PHP 5, and it accompanies the corresponding theory with educational examples.

  1. Using Directory Iterators and MySQL with Adapter Objects with PHP
  2. Working with directory iterators and adapters together
  3. Putting the adapter class to work
  4. Adapting MySQL result sets
By: Alejandro Gervasio
Rating: starstarstarstarstar / 6
December 13, 2006

print this article



Quite possibly, you'll remember that in the first part of the series I went through the definition and application of this design pattern, and additionally provided you with some illustrative code samples to demonstrate how the functionality of a given class can be easily expanded without using inheritance.

Now, speaking more specifically, you'll recall that the hands-on example that I developed in the first article was focused on creating a directory adapter class. This class was originally defined for extending the functionality of another one, in this case conceived as a generic directory processor.

Of course, the best thing about building an adapter class rests on the fact that this process is entirely performed without the need to use a more conventional approach, such as applying inheritance.

However, it should be noticed that the implementation of the adapter pattern with PHP is applicable particularly in those situations where working directly with subclasses is nearly impossible, or when a certain application has been so poorly developed that the only way to tackle a specific problem is by defining a new class that conforms to a predefined model.

In all other situations, inheritance is probably the best approach to follow when the functionality of an existing class must be extended inside the context of a given application.

All right, now that I recapitulated quickly the topics covered in the first article, let me tell you what you'll learn in this one. Provided that you understand the basic concepts of the adapter pattern, in this final tutorial, I'll show you how to use it in conjunction with the "DirectoryIterator" class, bundled with PHP 5, and with a couple of MySQL wrappers as well.

Having established the subject of this article, let's get started.

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