SingletonTrait: Trait to implement the singleton design pattern

Recommend this page to a friend!
  Info   Example   View files (3)   Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 101 All time: 9,368 This week: 359
Version License PHP version Categories
singletontrait 1.0BSD License5.4PHP 5, Design Patterns, Traits
Description Author

This package provides a trait to implement the singleton design pattern.

The trait provides functions that return a new instance of the class if none was created so far, or an already created instance of the class otherwise.

It may also force creating a new instance of the class even if another was created.

The trait uses reflection to call the class constructor passing any arguments as a list or as an array.

Picture of Aleksandar Zivanovic
  Performance   Level  
Name: Aleksandar Zivanovic <contact>
Classes: 15 packages by
Country: Serbia Serbia
Age: 26
All time rank: 17217 in Serbia Serbia
Week rank: 84 1 in Serbia Serbia
Innovation award
Innovation award
Nominee: 4x

File Role Description
class.Example.php Class Example class
example.php Example Example script
trait.Singleton.php Class Singleton Trait

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,368
This week:359

For more information send a message to info at phpclasses dot org.