merophp/singleton

Merophp 框架的单例模式实现

0.1-alpha 2021-12-22 10:53 UTC

This package is auto-updated.

Last update: 2024-09-18 21:25:14 UTC


README

Merophp 框架的单例类。

安装

通过 composer

composer require merophp/singleton

基本用法

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();