PHPackages                             mouf/pimple-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. [Framework](/categories/framework)
4. /
5. mouf/pimple-interop

ActiveLibrary[Framework](/categories/framework)

mouf/pimple-interop
===================

This project is a very simple extension to the Pimple microframework. It adds to Pimple compatibility with the container-interop APIs.

v1.0.0(11y ago)102.4M↑21.6%52MITPHP

Since Aug 19Pushed 9y ago1 watchersCompare

[ Source](https://github.com/moufmouf/pimple-interop)[ Packagist](https://packagist.org/packages/mouf/pimple-interop)[ Docs](http://mouf-php.com)[ RSS](/packages/mouf-pimple-interop/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (2)

Pimple-interop
==============

[](#pimple-interop)

[![Latest Stable Version](https://camo.githubusercontent.com/cf1030c60c4e8e0286ae5e1f2155b8c4183e8037f79dab4e3172602e35f1a3db/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f70696d706c652d696e7465726f702f762f737461626c652e737667)](https://packagist.org/packages/mouf/pimple-interop)[![Latest Unstable Version](https://camo.githubusercontent.com/881883e7253013c7af7c0152d5b7e398d29cc6a4aaac72f8278d1b98ac43c908/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f70696d706c652d696e7465726f702f762f756e737461626c652e737667)](https://packagist.org/packages/mouf/pimple-interop)[![License](https://camo.githubusercontent.com/f3325d3153338b7d710baf9fed5db25c5adb51b73054cab410b9bd072bef538a/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f70696d706c652d696e7465726f702f6c6963656e73652e737667)](https://packagist.org/packages/mouf/pimple-interop)[![SensioLabsInsight](https://camo.githubusercontent.com/89ca485f6bd9fab766a529725bce146da7cadbbafa3aedda0a6e81340b4217e5/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f39386435633432642d396434362d346537332d393336642d3665616338623932623363332f6d696e692e706e67)](https://insight.sensiolabs.com/projects/98d5c42d-9d46-4e73-936d-6eac8b92b3c3)

This package contains an extension to the [Pimple DI container](http://pimple.sensiolabs.org/) that makes Pimple 1 compatible with the [container-interop](https://github.com/container-interop/container-interop) API.

How to use it?
--------------

[](#how-to-use-it)

Instead of using the `Pimple` class, you can use the `PimpleInterop` class. This class extends `Pimple`. `PimpleInterop` implements `ContainerInterface`. This means you can access your Pimple entries by using the `get` and `has` methods. `PimpleInterop` constructor accepts an optional "root" container as a first argument. This means you can chain `PimpleInterop` with another container. Dependencies will be fetched from the "root" container rather than from PimpleInterop.

Here is a sample chaining 2 Pimple instances (in the real world, you would rather chain Pimple with a composite container than contains all the DI containers you are working with):

```
// Let's declare a first container
$pimpleParent = new PimpleInterop();
$pimpleParent['hello'] = 'world';

// Let's declare another container
// Please note the "parent" container is passed in parameter of the constructor.
$pimple = new PimpleInterop($pimpleParent);
$pimple['test']->share(function(ContainerInterop $container) {
	return "Hello ".$container->get('hello');
});

// Prints "Hello world".
echo $pimple->get('test');
// Prints "Hello world" too.
echo $pimple['test'];
```

Why the need for this package?
------------------------------

[](#why-the-need-for-this-package)

This package is part of a long-term effort to bring [interoperability between DI containers](https://github.com/container-interop/container-interop). The ultimate goal is to make sure that multiple containers can communicate together by sharing entries (one container might use an entry from another container, etc...)

But can't we already do this using Acclimate?
---------------------------------------------

[](#but-cant-we-already-do-this-using-acclimate)

The excellent [Acclimate library](https://github.com/jeremeamia/acclimate-container) can already provide an adapter around Pimple. The adapter implements the `ContainerInterface`.

However, the adapter design pattern cannot be used to have Pimple delegate its dependencies fetching to another container. Indeed, to implement this feature, you need to modify the very behaviour of the container, and the adapter design pattern is not always well suited for this.

Also, there are other cases where the adapter design pattern is not enough. For instance, the Silex MVC microframework is directly extending the Pimple class. We could fork the Silex MVC microframework to make it use PimpleInterop instead of Pimple easily. However, it would be almost impossible for Silex to use the adapted Pimple instance from Acclimate (because Silex relies on all the methods of Pimple that are not implemented by the adapter).

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 93.8% 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 ~79 days

Total

3

Last Release

4127d ago

Major Versions

1.0.x-dev → 2.0.x-dev2015-01-30

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (15 commits)")[![mnapoli](https://avatars.githubusercontent.com/u/720328?v=4)](https://github.com/mnapoli "mnapoli (1 commits)")

---

Tags

container-interopdependency-injectiondipimple

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mouf-pimple-interop/health.svg)

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

###  Alternatives

[yiisoft/injector

PSR-11 compatible injector. Executes a callable and makes an instances by injecting dependencies from a given DI container.

942.8M38](/packages/yiisoft-injector)[mouf/picotainer

This package contains a really minimalist dependency injection container compatible with container-interop.

16189.8k11](/packages/mouf-picotainer)[mouf/mouf

The Mouf PHP framework: an open-source PHP framework providing an easy way to download, install, use and reuse components, with a graphical user interface.

55146.0k17](/packages/mouf-mouf)[joomla/di

Joomla DI Package

15391.2k11](/packages/joomla-di)

PHPackages © 2026

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