nolikein/singleton 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nolikein/singleton

Composer 安装命令:

composer require nolikein/singleton

包简介

A singleton design pattern

README 文档

README

PHP Packagist version Packagist License Gitlab pipeline status Gitlab Code Coverage

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-10-31