merophp / singleton
Implementation of the singleton pattern for the Merophp Framework
Installs: 288
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/merophp/singleton
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.5
README
Singleton class for the Merophp Framework.
Installation
Via composer:
composer require merophp/singleton
Basic Usage
use Merophp\Singleton\Singleton;
use Merophp\Singleton\SingletonTrait;
use Merophp\Singleton\SingletonInterface;
class MySingleton extends Singleton
{
}
$mySingleton = MySingleton::getInstance();
//or use the singleton trait
class MySecondSingleton extends SingletonInterface
{
use SingletonTrait;
}
$mySecondSingleton = MySecondSingleton::getInstance();