PHP Classes

True Singleton Class: PHP implementation of the singleton design pattern

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 45%Total: 1,129 All time: 3,341 This week: 660Up
Version License PHP version Categories
singleton_class 1.0.5GNU General Publi...5.0PHP 5, Language, Design Patterns


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: 44
All time rank: 162692 in India India
Week rank: 258 Up21 in India India Up
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  
This week:0
All time:3,341
This week:660Up
 User Ratings  
 All time