|Ratings|| ||Unique User Downloads|| ||Download Rankings|
|Not yet rated by the users||Total: 29 ||All time: 10,748 This week: 161|
This class can be used to create object of a class that only has 1 instance.
Applications need to create a sub-class of this class to make that class only have one instance of the sub-class.
Attempts to create new objects of the same class after when the first instance of that class is created, will return the same object.
The class also provides a function to destroy the only instance of the singleton sub-class.
This class implements basic singleton pattern.
Using singleton behaviour in your applications is so simple as it can be. Just extend the class Singleton, and enjoy using it!
See the code:
// including all necessary files
require_once( dirname( dirname( dirname( __FILE__ ) ) ).'/conf/conf.php' );
require_once( $MEZON_PATH.'/vendor/singleton/singleton.php' );
// creatingyour own class
class MyClass extends Singleton
// methods and their implementations
You can see the Template Engine class for real usage of this pattern.
||Applications that use this package
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.