Few Design Patterns in PHP 5 : Singleton

Designs patterns exists for a long time ago, before informations systems. They have been use in building

Designs patterns are class models to approach somes problems that you can meet in yours developpements

They are numerous, I'll try to explains the majors

Somes oriented object programming basics are required to fully understand this article, in particular :

  • Classes, instances
  • Extends a class
  • Interface
  • Static variables
  • Public, protected and private attributes

The design patterns studied here are:

Design pattern summary

Even if you are not familiar with design patterns, perharps you have heard about Singleton.

This design pattern allow to have only one instance of a class.

Examples usage are numerous: configuration class, database object, etc...In this article, we'll use a configuration class.



Without this design pattern

With design pattern


Download examples

Previous - Page 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - Next