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

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

clippy/container
================

Dependency-injection container inspired by Pimple and PHP-DI Invoker

v1.4.3(4mo ago)089.0k↑13.6%11MITPHPPHP &gt;=7.2

Since Dec 8Pushed 4mo ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (11)Used By (1)

clippy/container
================

[](#clippycontainer)

This is a derivative of [pimple](https://pimple.symfony.com/) with a few notable changes.

Function parameter injection
----------------------------

[](#function-parameter-injection)

In standard Pimple, the service factories all receive `Container $c` as input, e.g.

```
$c['descendent'] = function($c) {
  return $c['parent']->generateDescendent()->withWhizBang();
};
```

In Clippy's container:

```
$c['descendent'] = function(MyParent $parent) {
  return $parent->generateDescendent()->withWhizBang();
};
```

This allows the consumers of services to (progressively) use type-hinting.

Service methods
---------------

[](#service-methods)

A "service method" is a function which supports *both* service-injection and runtime data-passing. For example:

```
$c['getPassword()'] = function ($domain, SymfonyStyle $io) {
  if (getenv('PASSWORD')) return getenv('PASSWORD');
  return $io->askHidden("What is the password for $domain?");
}
$c['app']->main('', function($getPassword) {
  $pass = $getPassword('example.com');
});
```

The first parameter to `getPassword` is given at runtime (`$getPassword('example.com')`); the second parameter (`$io`) is injected automatically.

The service-method is denoted by including `()` in the declaration. Compare:

```
// Standard service
$c['foo'] = function($injectedService, ...) { ... }

// Service method
$c['foo()'] = function($inputtedData, ... , $injectedService, ...)  { ... }
};
```

Autowired objects / anonymous service classes
---------------------------------------------

[](#autowired-objects--anonymous-service-classes)

The following allows for using injection with improvised service classes.

```
$c['basicService'] = 'something';
$c['newService'] = $c->autowiredObject(new class() {

  protected $basicService;

  public function double() {
    return $this->basicService . $this->basicService;
  }

});
```

Properties (eg `$basicService`) will be pre-populated with the corresponding services.

In the default `strict` mode, unmatched properties will produce exceptions. This can be disabled, e.g.

```
$c['newService'] = $c->autowiredObject(['strict' => FALSE], new class() { ..});
```

Similarly, you may define a regular service function and use autowiring as part of the logic, e.g.

```
$c['basicService'] = 'something';
$c['newService'] = function() use ($c) {
  return $c->autowire(new MyClass());
};
```

Sigils
------

[](#sigils)

In standard Pimple, you may define alternative handling for a callback by using a wrapper method. Clippy supports wrappers as well as a sigil notation.

```
// Run a function every time one reads `$c['theJoneses]`, with mix of inputs and services
$c['getPassword'] = $c->method(function ($domain, SymfonyStyle $io) { ... });
$c['getPassword()'] = function ($domain, SymfonyStyle $io) { ... };
$c['getPassword']('localhost');
$c['getPassword']('example.com');

// Create a new instance every time one reads `$c['theJonses']`:
$c['theJoneses'] = $c->factory(function() { return new CoolThing(microtime(1)); });
$c['theJoneses++'] = function() { return new CoolThing(microtime(1)); };
print_r($c['theJoneses']);
print_r($c['theJoneses']);
```

###  Health Score

48

—

FairBetter than 95% of packages

Maintenance77

Regular maintenance activity

Popularity31

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.4% 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 ~247 days

Recently: every ~350 days

Total

10

Last Release

123d ago

PHP version history (3 changes)v1.0.0PHP &gt;=7.0

v1.4.0PHP &gt;=7.4.0

v1.4.2PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1336047?v=4)[Tim Otten](/maintainers/totten)[@totten](https://github.com/totten)

---

Top Contributors

[![totten](https://avatars.githubusercontent.com/u/1336047?v=4)](https://github.com/totten "totten (27 commits)")[![seamuslee001](https://avatars.githubusercontent.com/u/6799125?v=4)](https://github.com/seamuslee001 "seamuslee001 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[illuminate/container

The Illuminate Container package.

31178.1M2.0k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

19951.9M114](/packages/symfony-type-info)[civicrm/civicrm-core

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

728272.9k20](/packages/civicrm-civicrm-core)[jaxon-php/jaxon-core

Jaxon is an open source PHP library for easily creating Ajax web applications

73142.3k25](/packages/jaxon-php-jaxon-core)[cedaro/satispress

Generate a Composer repository from installed WordPress plugins and themes.

56134.0k](/packages/cedaro-satispress)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)

PHPackages © 2026

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