PHPackages                             yucadoo/singleton-container - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. yucadoo/singleton-container

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

yucadoo/singleton-container
===========================

PSR-11 container decorator caching resolved instances.

2.0.0(6y ago)04MITPHPPHP ~7.2

Since Mar 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/yucadoo/singleton-container)[ Packagist](https://packagist.org/packages/yucadoo/singleton-container)[ Docs](https://github.com/yucadoo/singleton-container)[ RSS](/packages/yucadoo-singleton-container/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (3)Dependencies (3)Versions (5)Used By (0)

SingletonContainer
==================

[](#singletoncontainer)

[![Latest Version on Packagist](https://camo.githubusercontent.com/8e3c8c950b95bc8c22192348a4bd9ced6a1296894ec24084c971c1844f96781c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79756361646f6f2f73696e676c65746f6e2d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/singleton-container)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/cbdf4a2596a0acc63da141184a13a7f61d30bd62498b54ed026e3a7f89105df8/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f79756361646f6f2f73696e676c65746f6e2d636f6e7461696e65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/yucadoo/singleton-container)[![Coverage Status](https://camo.githubusercontent.com/d64b4a5bff24dfdb1e43b5a00440061533aac10d6a55f92b404f793878b6d457/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f79756361646f6f2f73696e676c65746f6e2d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/singleton-container/code-structure)[![Quality Score](https://camo.githubusercontent.com/ecf097b144f5e7ef63143245c10b654cd6be283b7f9b8851d0c073f7c9f1456a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f79756361646f6f2f73696e676c65746f6e2d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/yucadoo/singleton-container)[![Total Downloads](https://camo.githubusercontent.com/7b6cf8fefc8ba0db6d64aebb66658d210091a88c81d5abc97f89fc45b69db495/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79756361646f6f2f73696e676c65746f6e2d636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yucadoo/singleton-container)

PSR-11 container decorator caching resolved instances. This package is compliant with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md) and [PSR-11](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-11-container.md). If you notice compliance oversights, please send a patch via pull request.

Install
-------

[](#install)

Via Composer

```
$ composer require yucadoo/singleton-container
```

Usage
-----

[](#usage)

```
/** @var Psr\Container\ContainerInterface */
$resolvingContainer;
$singletonContainer = new YucaDoo\SingletonContainer\SingletonContainer($resolvingContainer);

// Resolves the instance using the injected container
$instance = $singletonContainer->get('Interface');
// Returns same instance
$sameInstance = $singletonContainer->get('Interface');

// Confirms that intance is cached
$singletonContainer->isCached('Interface');

// Clear cached instance
$singletonContainer->clear('Interface');
// Clear all cached instances
$singletonContainer->clearAll();
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Hrvoje Jukic](https://github.com/Firtzberg)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~17 days

Total

3

Last Release

2222d ago

Major Versions

1.0.1 → 2.0.02020-04-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/9c6e704cc57891bf1868f1afa8fda7068d53ba7fafdaabc630fec179c517665c?d=identicon)[Firtzberg](/maintainers/Firtzberg)

---

Top Contributors

[![Firtzberg](https://avatars.githubusercontent.com/u/8490119?v=4)](https://github.com/Firtzberg "Firtzberg (17 commits)")

---

Tags

decoratorpsr-11-compliantsingletonPSR-11dependency-injectiondisingletondecorator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/yucadoo-singleton-container/health.svg)

```
[![Health](https://phpackages.com/badges/yucadoo-singleton-container/health.svg)](https://phpackages.com/packages/yucadoo-singleton-container)
```

###  Alternatives

[php-di/php-di

The dependency injection container for humans

2.8k48.9M994](/packages/php-di-php-di)[laminas/laminas-servicemanager

Factory-Driven Dependency Injection Container

15955.1M694](/packages/laminas-laminas-servicemanager)[slince/di

A flexible dependency injection container

20260.4k6](/packages/slince-di)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
