2017 © Pedro Peláez
 

library singleton-pattern

A lightweight PHP implementation of the Design Pattern Singleton using trait.

image

byjg/singleton-pattern

A lightweight PHP implementation of the Design Pattern Singleton using trait.

  • Monday, June 11, 2018
  • by byjg
  • Repository
  • 1 Watchers
  • 5 Stars
  • 11,192 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 3 Versions
  • 10 % Grown

The README.md

Singleton Pattern

Build Status Opensource ByJG GitHub source GitHub license GitHub release, (*1)

A lightweight PHP implementation of the Design Pattern Singleton using trait. Just one class and no dependencies., (*2)

Create your class

require "vendor/autoload.php";

class Example
{
    // You need to use the trait here
    use \ByJG\DesignPattern\Singleton;

    // Put your code below
}

REMEMBER: Your class cannot have a public constructor. If it is necessary, use a private or protected constructor instead. Singleton classes does not have arguments in the constructor;, (*3)

Use your class

$example = Example::getInstance();

Install

composer require "byjg/singleton-pattern"

Run Tests

vendor/bin/phpunit

References

  • https://en.wikipedia.org/wiki/Singleton_pattern

Dependencies

flowchart TD
    byjg/singleton-pattern

Open source ByJG, (*4)

The Versions

11/06 2018

dev-master

9999999-dev

A lightweight PHP implementation of the Design Pattern Singleton using trait.

  Sources   Download

MIT

The Development Requires

by João Gilberto Magalhães

15/07 2015

1.0.1

1.0.1.0

A lightweight PHP implementation of the Design Pattern Singleton using trait.

  Sources   Download

MIT

by João Gilberto Magalhães

13/07 2015

1.0.0

1.0.0.0

A lightweight PHP implementation of the Design Pattern Singleton using trait.

  Sources   Download

MIT

by João Gilberto Magalhães