Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2020-11-18 (29 days ago) | | Not yet rated by the users | | Total: 22 This week: 2 | | All time: 10,104 This week: 90 |
|
Description | | Author |
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. | |
|
|
Innovation award
Nominee: 4x |
|
Details
Singleton
Intro
This class implements basic singleton pattern.
Usage
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
}
That's all!
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.