PHPackages                             krubio/perfect-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. krubio/perfect-container

Abandoned → [perfectapp/perfect-container-psr-11](/?search=perfectapp%2Fperfect-container-psr-11)ArchivedLibrary[PSR &amp; Standards](/categories/psr-standards)

krubio/perfect-container
========================

BROKEN Critical string handling bugs. Use perfectapp/perfect-container-psr-11 instead.

v1.2.1(1y ago)11381MITPHPPHP &gt;=8.2.0CI passing

Since May 30Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/benanamen/perfect-container)[ Packagist](https://packagist.org/packages/krubio/perfect-container)[ RSS](/packages/krubio-perfect-container/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (6)Used By (1)

[![Build](https://github.com/benanamen/perfect-container/actions/workflows/build.yml/badge.svg)](https://github.com/benanamen/perfect-container/actions/workflows/build.yml)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0e0202e278ebc91d1ce74e5c2e534b961465557a3563a64e9ddcf379a4dd6880/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e616e616d656e2f706572666563742d636f6e7461696e65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/benanamen/perfect-container/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/b61c350f89ea820ef84884e3d98daae66b2c5cdf9683fc3466c868453c0616ed/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e616e616d656e2f706572666563742d636f6e7461696e65722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/benanamen/perfect-container/?branch=master)[![Build Status](https://camo.githubusercontent.com/0f80a17efa4ed47a8d79ea2dcda4ffc09bf226f244d25307ac86edb3e98c0c79/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e616e616d656e2f706572666563742d636f6e7461696e65722f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/benanamen/perfect-container/build-status/master)[![Code Intelligence Status](https://camo.githubusercontent.com/1234b28c8cf201b5c5a02ce596ed2d0af06e687834f1aa4ce8d4596a0ce512d7/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656e616e616d656e2f706572666563742d636f6e7461696e65722f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

[![Coverage](https://camo.githubusercontent.com/3b53838b3083155d8a538e48392149a83caa038b88af42ca96d38c8b1837e96a/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Maintainability Rating](https://camo.githubusercontent.com/4636caf4f3cb5cf71c3bb9ec146f3b0a4ce3f379260b555e7d201c47b0296ab3/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Code Smells](https://camo.githubusercontent.com/2e911c5fa0bb757832b97977365da0e70be92d9d6ea90d2906712251bb8f394d/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d636f64655f736d656c6c73)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Technical Debt](https://camo.githubusercontent.com/e086cd31532ccde264be95574a0facc83f1473c1b4a6705416245be7e316c5ca/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d7371616c655f696e646578)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)

[![Duplicated Lines (%)](https://camo.githubusercontent.com/f3220144e244110475f479a52cecf60d50ab49606e1997025d8acd7e82e36e4f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d6475706c6963617465645f6c696e65735f64656e73697479)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Vulnerabilities](https://camo.githubusercontent.com/77ff94c00d4b9d98d52c0ea6f307d61ef59f9bb4b8fa8c7c1785d842d4dae0c4/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Bugs](https://camo.githubusercontent.com/90d11c75c35b9a490353edb1da5b8a2802735aad0af2fe341bf7f50bfee17af1/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d62756773)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)[![Security Rating](https://camo.githubusercontent.com/85babf90e2fadf6f6700be66ec4a2afad4c220bbe874c99ee604a584a28f5163/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d636f6e7461696e6572266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-container)

⚠️ SECURITY WARNING: BROKEN - DO NOT USE
========================================

[](#️-security-warning-broken---do-not-use)

This container has critical bugs and should not be used in production.

🚨 Critical Issues:
------------------

[](#-critical-issues)

- **String handling bug**: All string values are treated as class names
- **Fatal errors**: Simple values cause class instantiation attempts
- **Production risks**: Unexpected fatal errors in production environments

✅ Recommended Replacement:
--------------------------

[](#-recommended-replacement)

Migrate immediately to: [perfectapp/perfect-container-psr-11](https://github.com/...)

🔒 This repository is archived and no longer maintained.
-------------------------------------------------------

[](#-this-repository-is-archived-and-no-longer-maintained)

PerfectContainer
================

[](#perfectcontainer)

Description
-----------

[](#description)

PerfectContainer is a lightweight, easy-to-use Dependency Injection Container designed for PHP applications. It facilitates the management of class dependencies, promoting a clean and decoupled codebase. PerfectContainer allows developers to bind interfaces to concrete implementations, making it easier to swap out dependencies without modifying the dependent classes.

Features
--------

[](#features)

- **Simple API**: Easy to use API for binding and resolving dependencies.
- **Singleton Binding**: Bind classes as singletons to reuse the same instance across the application.
- **Auto-Resolving**: Automatically resolve dependencies through type-hinted constructor injection.
- **PSR-11 Compliant**: Adheres to the PSR-11 Container Interface standard.

Upcoming Changes in Version 2.0.0
---------------------------------

[](#upcoming-changes-in-version-200)

In Version 2.0.0, we are introducing a method renaming for improved consistency:

- **Method Renaming**: The `bind` method will be renamed to `set`. This change is aimed at providing clearer semantics and aligning with standard practices in dependency injection containers.

### Deprecation Notice

[](#deprecation-notice)

Starting from Version 1.1.0, the `bind` method is deprecated, and we encourage you to start using `set` to align with the upcoming changes in Version 2.0.0.

- **Deprecated**: The `bind` method is deprecated and will be removed in a future release (Version 2.0.0). Please update your usage to `set` to ensure compatibility with future versions.

We encourage you to update your usage accordingly to ensure compatibility with the latest version of PerfectContainer.

Installation
------------

[](#installation)

Use Composer to install the PerfectContainer library.

```
composer require krubio/perfect-container
```

Usage
-----

[](#usage)

Here's a basic usage example of PerfectContainer:

```
require 'vendor/autoload.php';

use PerfectApp\Container\Container;

$container = new Container();

// Binding and resolving dependencies
$container->set('SomeInterface', 'SomeImplementation');
$instance = $container->get('SomeInterface');
```

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

[](#contributing)

Contributions, issues, and feature requests are welcome!

License
-------

[](#license)

This project is [MIT](LICENSE) licensed.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance48

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

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 ~1 days

Total

5

Last Release

713d ago

Major Versions

v0.1.0 → v1.1.02024-06-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/92efcd3e8d87753dc819d970a254160b7ea8a60de6a127e7f93acada576b49c5?d=identicon)[benanamen](/maintainers/benanamen)

---

Top Contributors

[![benanamen](https://avatars.githubusercontent.com/u/1039435?v=4)](https://github.com/benanamen "benanamen (31 commits)")

---

Tags

containercontainerdi containerautowiredependency injection containerAttribute Routing

###  Code Quality

TestsCodeception

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/krubio-perfect-container/health.svg)

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

###  Alternatives

[psr/container

Common Container Interface (PHP FIG PSR-11)

10.0k1.0B3.7k](/packages/psr-container)[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)[php-di/php-di

The dependency injection container for humans

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

A serializable dependency injection container with constructor and setter injection, interface and trait awareness, configuration inheritance, and much more.

356968.3k58](/packages/aura-di)[league/container

A fast and intuitive dependency injection container.

86387.8M343](/packages/league-container)[mrclay/props-dic

Props is a simple DI container that allows retrieving values via custom property and method names

3611.7M3](/packages/mrclay-props-dic)

PHPackages © 2026

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