PHP Classes

True Singleton Class: PHP implementation of the singleton design pattern

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   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
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: 45
All time rank: 162692 in India India
Week rank: 227 Up15 in India India Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files (3)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,129
This week:0
All time:3,341
This week:660Up
 User Ratings  
 
 All time
Utility:65%StarStarStarStar
Consistency:60%StarStarStarStar
Documentation:-
Examples:70%StarStarStarStar
Tests:-
Videos:-
Overall:45%StarStarStar
Rank:3332