gebruederheitz/simple-singleton

A simple implementation of a singleton as an extensible abstract class or as a trait.

v1.0.1 2022-02-08 19:07 UTC

This package is auto-updated.

Last update: 2024-11-09 01:20:49 UTC


README

A simple implementation of a singleton class in two flavours, ideal (and written for) Wordpress projects.

The contained class is a near copy of the example used at https://refactoring.guru/design-patterns/singleton/php/example#example-1, kudos to the author(s).

Installation

> composer require gebruederheitz/simple-singleton

Usage

Extend the abstract class or use the trait. Your class' constructor needs to be protected.

Development

Dependencies

  • PHP >= 7.4
  • Composer 2.x
  • NVM and nodeJS LTS (v16.x)
  • Nice to have: GNU Make (or drop-in alternative)