piotrpress / singleton
This library is a Singleton (anti)pattern implementation using a Traits with a support for an Object Inheritance and passing parameters to the constructor.
Installs: 162
Dependents: 4
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/piotrpress/singleton
Requires
- php: >=7.4
README
This library is a Singleton (anti)pattern implementation using a Traits with a support for an Object Inheritance and passing parameters to the constructor.
Installation
composer require piotrpress/singleton
Usage
require __DIR__ . '/vendor/autoload.php'; use PiotrPress\Singleton; class ExampleParent { use Singleton; } class Example extends ExampleParent { protected function __construct( $arg ) {} } Example::getInstance( 'arg' );
Requirements
PHP >= 7.4
version.