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(5mo ago)097.5k—0.6%11MITPHPPHP &gt;=7.2

Since Dec 8Pushed 5mo ago1 watchersCompare

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

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

47

—

FairBetter than 93% of packages

Maintenance70

Regular maintenance activity

Popularity32

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

168d 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

[symfony/dependency-injection

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

4.2k455.6M9.6k](/packages/symfony-dependency-injection)[illuminate/contracts

The Illuminate Contracts package.

706130.3M13.3k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31182.0M2.4k](/packages/illuminate-container)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k51](/packages/ecotone-ecotone)[moodle/moodle

Moodle - the world's open source learning platform

7.2k88.5k80](/packages/moodle-moodle)[symfony/type-info

Extracts PHP types information.

20069.8M269](/packages/symfony-type-info)

PHPackages © 2026

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