PHP Classes

True Singleton Class: PHP implementation of the singleton design pattern

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2007-09-26 (8 years ago) RSS 2.0 feedStarStarStar 48%Total: 1,117 All time: 3,195 This week: 1,049Up
Version License PHP version Categories  
singleton_class 1.0.5GNU General Publi...5.0PHP 5, Language, Design Patterns
Description Author  

In software engineering, a design pattern is a general solution to a common problem in software design. One of these design patterns is called the Singleton. It's purpose can be described quite briefly as follows:

Ensure a class has only one instance and provide a global point of access to it.

It achieves this by only creating a new instance the first time it is referenced, and thereafter it simply returns the handle to the existing instance.


sTonClass is a base class that implements the singleton design pattern.

The class can only be instantiated using a static function that assures that there is only one object of that class.

If the class was already instantiated, it returns a reference to the previously created class object.

The class also provides functions for store, retrieving and deleting object properties.

Picture of sourav ray
Name: sourav ray is available for providing paid consulting. Contact sourav ray .
Classes: 2 packages by
Country: India India
Age: 36
All time rank: 153585 in India India
Week rank: 1623 Down121 in India India Down
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file singleton.class.php Class Singleton Class
Accessible without login Plain text file License.txt Lic. GPL License for sTonClass
Accessible without login Plain text file example.php Example example of use of singleton class

 Version Control Unique User Downloads Download Rankings  
 0%Total:1,117All time:3,195
 This week:0This week:1,049Up
 User Ratings  
 All time