PHPackages                             jtreminio/zimple - 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. [Testing &amp; Quality](/categories/testing)
4. /
5. jtreminio/zimple

ActiveLibrary[Testing &amp; Quality](/categories/testing)

jtreminio/zimple
================

A wrapper for Pimple container that adds several useful features to make it easier to manage your code!

v1.1(12y ago)101.4kMITPHPPHP &gt;=5.3.0

Since Apr 23Pushed 12y ago1 watchersCompare

[ Source](https://github.com/jtreminio/Zimple)[ Packagist](https://packagist.org/packages/jtreminio/zimple)[ Docs](https://github.com/jtreminio/Zimple)[ RSS](/packages/jtreminio-zimple/feed)WikiDiscussions master Synced 1mo ago

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

Zimple
======

[](#zimple)

This is a wrapper around the simple Pimple container. It provides a few features that makes handling objects and writing tests much easier.

If you have a codebase that is untestable and you are unable to offer deep refactoring to make it untestable, having a container such as this one is a good step toward gaining control over your codebase.

Installation
============

[](#installation)

Add it to your `composer.json` file:

```
"jtreminio/zimple": "1.0.*@dev"

```

Then run `./composer.phar update`. This will also install the [Pimple container](https://github.com/fabpot/Pimple)

Now just put it in your code:

```
Zimple::setPimple(new Pimple);

```

Usage
=====

[](#usage)

Zimple accepts a fully qualified name:

```
$date = Zimple::get('\DateTime');

```

You can also pass in an optional array of parameters for the object constructor:

```
$date = Zimple::get('\DateTime', array('now', Zimple::get('\DateTimeZone')));

```

By default Zimple returns a new instance of an object everytime you call `Zimple::get()`. You can override this behavior by calling `Zimple::set()` and setting the third parameter to `true`:

```
$today = Zimple::get('\DateTime');
$tomorrow = Zimple::get('\DateTime', array('tomorrow'));

// $today !== $tomorrow

Zimple::set('\DateTime', $tomorrow, true);

$tomorrowDup = Zimple::get('\DateTime');

// $tomorrowDup == $tomorrow

$twoDaysAgo = Zimple::get('\DateTime', array('2 days ago'));

// $twoDaysAgo == $tomorrow

```

You can define objects as you normally would for Pimple before or after passing to Zimple:

```
// From Pimple's homepage
$pimple = new Pimple;

// define some objects
$pimple['session_storage'] = function ($c) {
    return new $c['session_storage_class']($c['cookie_name']);
};

$pimple['session'] = function ($c) {
    return new Session($c['session_storage']);
};

Zimple::setPimple($pimple);

```

Then access them as normal: `$session = Zimple::get('session_storage');`

Zimple is a Weird Name
======================

[](#zimple-is-a-weird-name)

Zimple wraps around Pimple, which is a gross name. [SandyZoop](http://www.reddit.com/user/SandyZoop) recommended I name it Cyst or Zit, which is equally gross. The goal of this container is to make dependency management simple and easy to use, and make previously untestable code testable.

Pimple + Simple = Zimple.

You can always alias it with

```
use jtreminio\Zimple\Zimple as Container;
Container::setPimple(new Pimple);
$date = Container::get('\DateTime');

```

Testing
=======

[](#testing)

Zimple makes the process of inserting mocks from your tests extremely easy. It makes use of `::set()` to prevent the code from overwriting the PHPUnit mock. Check out the tests for several easy examples.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

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

Total

2

Last Release

4658d ago

### Community

Maintainers

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

---

Top Contributors

[![jtreminio](https://avatars.githubusercontent.com/u/589398?v=4)](https://github.com/jtreminio "jtreminio (42 commits)")

---

Tags

testingcontainerunit testingdependency-injectioniocdicinversion of controlpimple

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jtreminio-zimple/health.svg)

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

###  Alternatives

[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[donatj/mock-webserver

Simple mock web server for unit testing

1382.5M79](/packages/donatj-mock-webserver)[yoast/wp-test-utils

PHPUnit cross-version compatibility layer for testing plugins and themes build for WordPress

632.3M51](/packages/yoast-wp-test-utils)[fiunchinho/phpunit-randomizer

Execute your test cases in random order, so you can check if they have hidden dependencies

50752.0k18](/packages/fiunchinho-phpunit-randomizer)[capsule/di

A PSR-11 compliant autowiring dependency injection container.

2857.5k2](/packages/capsule-di)[lastzero/test-tools

Increases testing productivity by adding a service container and self-initializing fakes to PHPUnit

2244.3k13](/packages/lastzero-test-tools)

PHPackages © 2026

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