unknownrori/singleton

This package is abandoned and no longer maintained. No replacement package was suggested.

A simple helper trait and class that can help follow singleton rule

0.9 2022-06-30 23:09 UTC

This package is auto-updated.

Last update: 2023-03-24 10:18:10 UTC


README

A very simple and basic Singleton design pattern helper package.

🚀 Installation

composer require unknownrori/singleton

Usage

By using extends keyword to inherit Singleton abstract class

<?php

namespace UnknownRori\Singleton\Tests;

use UnknownRori\Singleton\Singleton;

class DummyClass extends Singleton
{
    //
}

Or by using trait

<?php

namespace UnknownRori\Singleton\Tests;

use UnknownRori\Singleton\SingletonTrait;

class DummyClassTrait
{
    use SingletonTrait;
}