thesmart / singleton
A simple Singleton pattern, with optional support for named instances.
v0.0.2
2012-07-27 08:03 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-12-21 13:26:20 UTC
README
A simple Singleton pattern, with optional support for named instances.
Example:
MyClass::setInstance(new MyClass());
$myClass = Singleton::getInstance();
$has = SingletonMock::hasInstance();
Named instances:
SingletonMock::setInstance($myClass, 'foobar');
$myClass = Singleton::getInstance('foobar');
$has = SingletonMock::hasInstance('foobar');
Like this project?
Check out my others. @thesmart