2017 © Pedro Peláez
 

library multiton

A trait to implement the Multiton design pattern without any dependencies.

image

michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  • Friday, January 19, 2018
  • by michaelspiss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 90 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

Multiton

A trait to implement the Multiton design pattern without any dependencies., (*1)

Build Status Coverage Status, (*2)

Installation

$ composer require michaelspiss/multiton

Basic Usage

One line is enough to turn a class (called DatabaseAccess only for demonstration purposes) into a multiton:, (*3)

<?php

class DatabaseAccess {

    use MichaelSpiss\DesignPatterns\Multiton;

    ...
}

To retrieve the multiton instance, simply call ::getInstance() with a unique identifier:, (*4)

$instance = DatabaseAccess::getInstance('ID');

Another instance can be retrieved by doing the exact same with another ID., (*5)

During initialization the constructor is called with the identifier as argument. You can change the __construct() method as you wish, as long as it only requires the identifier as attribute and it's visibility is protected, to prevent instantiations via the new operator., (*6)

PHP Requirements

  • PHP >= 5.4

License

MIT, (*7)

The Versions

19/01 2018

dev-master

9999999-dev https://github.com/michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

by Michael Spiss

pattern multiton design-pattern

31/10 2017

dev-remove-author-section

dev-remove-author-section https://github.com/michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

by Michael Spiss

pattern multiton design-pattern

20/04 2017

v1.0.1

1.0.1.0 https://github.com/michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

by Michael Spiss

pattern multiton design-pattern

20/04 2017

dev-develop

dev-develop https://github.com/michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

by Michael Spiss

pattern multiton design-pattern

19/04 2017

v1.0.0

1.0.0.0 https://github.com/michaelspiss/multiton

A trait to implement the Multiton design pattern without any dependencies.

  Sources   Download

MIT

The Requires

  • php >= 5.4

 

The Development Requires

by Michael Spiss

pattern multiton design-pattern