merophp/singleton

Implementation of the singleton pattern for the Merophp Framework

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

This package is auto-updated.

Last update: 2024-05-18 20:43:37 UTC


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