PHPackages                             nacosvel/container-interop - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nacosvel/container-interop

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nacosvel/container-interop
==========================

Achieve compatibility and interoperability among different container objects.

1.x-dev(1y ago)0371MITPHPPHP &gt;=8.0

Since Sep 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nacosvel/container-interop)[ Packagist](https://packagist.org/packages/nacosvel/container-interop)[ RSS](/packages/nacosvel-container-interop/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

Nacosvel Container Interop
==========================

[](#nacosvel-container-interop)

Achieve compatibility and interoperability among different container objects.
-----------------------------------------------------------------------------

[](#achieve-compatibility-and-interoperability-among-different-container-objects)

The library discovers available PSR-11 container implementations by searching for a list of known classes that implement the relevant interfaces, and returns an instance of the first one found. It supports binding, instantiation, and allows executing specific callbacks or logic when a class or dependency is resolving (i.e., instantiated or injected).

[![GitHub Tag](https://camo.githubusercontent.com/33c281c839e28fc873557f92ac246ee995717f1479fce968539aae183ede274f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f7461672f6e61636f7376656c2f636f6e7461696e65722d696e7465726f70)](https://github.com/nacosvel/container-interop/tags)[![Total Downloads](https://camo.githubusercontent.com/53e9c918b5bf8d8316bf9e9b5b5b57c05f339a40c8b3c3b5b09a3adee8a5001e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e61636f7376656c2f636f6e7461696e65722d696e7465726f703f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nacosvel/container-interop)[![Packagist Version](https://camo.githubusercontent.com/dc2f1b8e162409f4efbcfa07730b18b9d7396fe209fdeffacfcecf383b574fa7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e61636f7376656c2f636f6e7461696e65722d696e7465726f70)](https://packagist.org/packages/nacosvel/container-interop)[![Packagist PHP Version Support](https://camo.githubusercontent.com/6dbe2d713d942d228194a4ac1dc26cc073c71ca4b52605be698b7bf69ceee26a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6e61636f7376656c2f636f6e7461696e65722d696e7465726f70)](https://github.com/nacosvel/container-interop)[![Packagist License](https://camo.githubusercontent.com/efeef7dce115cc185690d41a9add134aa063801cb1aea97aee56b38dc02a9bd7/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e61636f7376656c2f636f6e7461696e65722d696e7465726f70)](https://github.com/nacosvel/container-interop)

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

[](#installation)

You can install the package via [Composer](https://getcomposer.org/):

```
composer require nacosvel/container-interop
```

Usage
-----

[](#usage)

### Default Method Names

[](#default-method-names)

If your container uses the standard method names (bind, make, resolving), you can simply call:

```
use Nacosvel\Container\Interop\Discover;

Discover::container();
```

discovers available PSR-11 container implementations by searching for a list of known classes that implement the relevant interfaces

### Custom Method Names

[](#custom-method-names)

If your container uses different method names, specify them as follows:

```
use Nacosvel\Container\Interop\Discover;

Discover::container(
    container: $container,
    bind: 'customBindMethod',
    make: 'customMakeMethod',
    resolving: 'customResolvingMethod'
);
```

- `container`: The container instance you want to work with.
- `bind`: The name of the method used for binding dependencies.
- `make`: The name of the method used for creating instances.
- `resolving`: The name of the method used for resolving dependencies.

### Accessing the Application

[](#accessing-the-application)

Let's look at a simple example:

```
use Nacosvel\Container\Interop\Application;

$application = Application::getInstance();
```

The `application` function returns the Application instance:

```
$application = application();
```

### Accessing the Container

[](#accessing-the-container)

Once configured, third-party packages can access the container using:

```
use Nacosvel\Container\Interop\Application;

$container = Application::getInstance()->getContainer();
```

If needed, you may specify which `Container` instance you would like to access:

```
$container = application()->getContainer();
```

### Accessing the Service

[](#accessing-the-service)

You may pass a class or interface name to resolve service from the container:

```
$cache = application(Cache::class);
$cache = application()->make(Cache::class);
```

This method ensures compatibility with various container implementations without worrying about their specific methods.

License
-------

[](#license)

Nacosvel Container Interop is made available under the MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

600d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2da9b458375a1b7972b7c4d26a5bf8f3e48db305e8805da36f253956f33c5568?d=identicon)[jundayw](/maintainers/jundayw)

---

Top Contributors

[![jundayw](https://avatars.githubusercontent.com/u/16873970?v=4)](https://github.com/jundayw "jundayw (8 commits)")

### Embed Badge

![Health badge](/badges/nacosvel-container-interop/health.svg)

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

###  Alternatives

[symfony/dependency-injection

Allows you to standardize and centralize the way objects are constructed in your application

4.2k431.1M7.5k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.1k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31278.1M2.0k](/packages/illuminate-container)[ecotone/ecotone

Supporting you in building DDD, CQRS, Event Sourcing applications with ease.

558549.8k17](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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