nolikein/singleton
Composer 安装命令:
composer require nolikein/singleton
包简介
A singleton design pattern
README 文档
README
A librairy to use the singleton design pattern. Thanks to the project of domnikl.
Installation
Install and Use Composer:
PHP 8.3
composer require nolikein/singleton ^2.0.0
PHP 8.2 and bellow
composer require nolikein/singleton ^1.1.0
Usage
You can create a singleton from 2 ways.
Extending
use Nolikein\Singleton\SingletonClass;
class MyClass extends SingletonClass {}
Using trait
use Nolikein\Singleton\SingletonTrait;
class MyClass
{
use SingletonTrait;
}
Finally, you can create an instance:
$instance = MyClass::getInstance();
Testing
Run tests with coverage
displayed as html in tests/Coverage directory
docker compose run --rm php ./vendor/bin/phpunit --configuration phpunit.xml --coverage-text --color
sudo chown $USER:$USER -R tests/Coverage
Licence
The project is under lincence MIT.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-10-31