PHPackages                             andyleap/popple - 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. andyleap/popple

ActiveLibrary[Framework](/categories/framework)

andyleap/popple
===============

Simple Dependency Injection container inspired by Pimple

0.2.0(12y ago)038GPLv2PHPPHP &gt;=5.3.0

Since Aug 2Pushed 12y ago1 watchersCompare

[ Source](https://github.com/andyleap/popple)[ Packagist](https://packagist.org/packages/andyleap/popple)[ Docs](http://github.com/andyleap/popple)[ RSS](/packages/andyleap-popple/feed)WikiDiscussions develop Synced 4w ago

READMEChangelogDependenciesVersions (7)Used By (0)

Popple
======

[](#popple)

Develop
-------

[](#develop)

[![Build Status](https://camo.githubusercontent.com/34baef0a07d0a4a5a2d74bd36d5f117637c125bb0e23172ae0d9aa9de09f22a1/68747470733a2f2f7472617669732d63692e6f72672f616e64796c6561702f706f70706c652e706e673f6272616e63683d646576656c6f70)](https://travis-ci.org/andyleap/popple)

Simple DI container for PHP inspired by Pimple.

What does Popple offer over the simplicity of Pimple?

Quite simply, Popple tries to maintain the same level of simplicity, while offering additional functionality to make it easier to work with.

For instance, extending services with Pimple requires several steps and a little bit of work around, as you have to extend the service, and then share it.

With Popple, that's handled for you. Popple takes the viewpoint that everything is shared, so, first, you create the service.

```
$popple = new Popple();

$popple->Share('db', function($p)
{
  $db = new Popple();
	$db->Extend('Connect', function()
	{
		if(!isset($this['username']))
		{
			die('Username required!');
		}
		echo 'Connecting as ' . $this['username'];
	});
	return $db;
});

```

This creates a simple service of the main $popple instance. It's accessed and used rather simply

```
$popple['db']['username'] = 'guest';
$popple['db']->Connect();

```

This also showcases another feature of Popple, it's ability to quickly extend out and form a service on it's own, without requiring formalized classes, while still allowing easy transitioning to a class structure. Hence, the above is roughly equivalent to

```
public class DB extends Popple
{
  public function Connect()
  {
    if(!isset($this['username']))
  	{
			die('Username required!');
		}
		echo 'Connecting as ' . $this['username'];
  }
}

$popple->Share('db', function($p)
{
  return new DB();
});

```

Then, all you do is Mutate the service to alter it

```
$popple->Mutate('db', function($db)
{
  $oldconnect = $db->Connect;
	$db->Extend('Connect', function() use ($oldconnect)
	{
		$oldconnect();
		if(!isset($this['password']))
		{
			die('Password required!');
		}
		echo ' with password ' . $this['password'];
	});
	return $db;
});

```

Then, all you have to do to use the new Connect method is

```
$popple['db']['username'] = 'admin';
$popple['db']['password'] = 'password';
$popple['db']->Connect();

```

Note that the Mutation can occur at any point. The service may have already been instantiated, it may be registered and the mutation queued to occur on instantiation, or the service may not even be registered yet. No matter what, it will work out. This is useful for services that mutually alter each other. Just register the Mutate on the other, and let it all work out. You can even register Mutates for services that never get added without any ill effects.

The final additional feature of Popple is it's ability to be "Popped", hence the naming.

Popping a Popple causes all of it's shared services to be instantiated, and this instantiation walks down the tree, in turn popping any additional Popples or anything that implements Poppable.

This seems rather backwards, as part of the advantage of a system like this is to delay or prevent instantiation as much as possible, but some use cases have slack time when loading could occur, and loading while processing requests later could be minimized by preloading all services

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

5

Last Release

4712d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b83cb8806d99a29648c36a8561470bf359319e61566987d53d3ea56f2a25a80?d=identicon)[andyleap](/maintainers/andyleap)

---

Top Contributors

[![andyleap](https://avatars.githubusercontent.com/u/1445195?v=4)](https://github.com/andyleap "andyleap (27 commits)")

---

Tags

dependency-injection

### Embed Badge

![Health badge](/badges/andyleap-popple/health.svg)

```
[![Health](https://phpackages.com/badges/andyleap-popple/health.svg)](https://phpackages.com/packages/andyleap-popple)
```

###  Alternatives

[jms/di-extra-bundle

Allows to configure dependency injection using annotations

32713.3M88](/packages/jms-di-extra-bundle)[rdlowrey/auryn

Auryn is a dependency injector for bootstrapping object-oriented PHP applications.

7242.3M76](/packages/rdlowrey-auryn)[yiisoft/injector

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

943.2M46](/packages/yiisoft-injector)[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.3k17](/packages/mouf-mouf)[mouf/pimple-interop

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

102.5M2](/packages/mouf-pimple-interop)[lcobucci/di-builder

Dependency Injection Builder for PHP applications

34189.3k6](/packages/lcobucci-di-builder)

PHPackages © 2026

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