gebruederheitz / simple-singleton
A simple implementation of a singleton as an extensible abstract class or as a trait.
Installs: 1 203
Dependents: 8
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=7.3
Requires (Dev)
- phpstan/phpstan: ^1.4
- szepeviktor/phpstan-wordpress: ^1.0
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)