Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/michaelspiss/singleton
- Owner: michaelspiss
- Created: 2017-04-15T11:36:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-27T19:07:44.000Z (almost 7 years ago)
- Last Synced: 2024-11-21T23:44:53.433Z (about 1 month ago)
- Topics: dependency-free, design-pattern, singleton, singleton-pattern
- Language: PHP
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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