Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/michaelspiss/singleton

A trait to implement the singleton design pattern without any dependencies.
https://github.com/michaelspiss/singleton

dependency-free design-pattern singleton singleton-pattern

Last synced: 25 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# Singleton
A trait to implement the Singleton design pattern without any dependencies.

[![Build Status](https://travis-ci.org/michaelspiss/singleton.svg?branch=master)](https://travis-ci.org/michaelspiss/singleton)
[![Coverage Status](https://coveralls.io/repos/github/michaelspiss/singleton/badge.svg?branch=master)](https://coveralls.io/github/michaelspiss/singleton?branch=master)

## Why?
There already are plenty other singleton packages, so why another one?
Simply, because most of those packages implement a factory, rather than a singleton pattern.
This and many more things bothered me about them, so here is a simple, dependency-free and fully tested
singleton.

## Installation

```
$ composer require michaelspiss/singleton
```

# Basic Usage
One line is enough to turn a class into a singleton:

```php
= 5.4

## License
MIT