merophp / singleton
Implementation of the singleton pattern for the Merophp Framework
0.1-alpha
2021-12-22 10:53 UTC
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();