PHPackages                             mediawiki/callback-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. [PSR &amp; Standards](/categories/psr-standards)
4. /
5. mediawiki/callback-container

ActiveLibrary[PSR &amp; Standards](/categories/psr-standards)

mediawiki/callback-container
============================

A very simple callback container/builder library

3.0.0(3mo ago)011.0k1GPL-2.0-or-laterPHPPHP &gt;=8.1CI passing

Since Mar 29Pushed 3mo agoCompare

[ Source](https://github.com/SemanticMediaWiki/callback-container)[ Packagist](https://packagist.org/packages/mediawiki/callback-container)[ Docs](https://github.com/SemanticMediaWiki/callback-container)[ Fund](https://www.semantic-mediawiki.org/wiki/Sponsorship)[ Fund](https://opencollective.com/smw)[ RSS](/packages/mediawiki-callback-container/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

Callback container
==================

[](#callback-container)

[![CI](https://github.com/SemanticMediaWiki/callback-container/actions/workflows/ci.yml/badge.svg)](https://github.com/SemanticMediaWiki/callback-container/actions/workflows/ci.yml)[![Latest Stable Version](https://camo.githubusercontent.com/301ac91e8fb57cb2372629fd93750093f62e0f956092bf3adb34866d6647c3b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6564696177696b692f63616c6c6261636b2d636f6e7461696e65722e737667)](https://camo.githubusercontent.com/301ac91e8fb57cb2372629fd93750093f62e0f956092bf3adb34866d6647c3b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6564696177696b692f63616c6c6261636b2d636f6e7461696e65722e737667)[![Total Download Count](https://camo.githubusercontent.com/30f9ad0a7ba12d9dc816c9839b1c183f44fad22fb4c4d307dfbab6e5fa001db7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6564696177696b692f63616c6c6261636b2d636f6e7461696e65722e737667)](https://camo.githubusercontent.com/30f9ad0a7ba12d9dc816c9839b1c183f44fad22fb4c4d307dfbab6e5fa001db7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6564696177696b692f63616c6c6261636b2d636f6e7461696e65722e737667)[![codecov](https://camo.githubusercontent.com/56b221450bdaaf7b9eadbd8ebdf850002dabb9e57ff5ac9f4a0a40203cfb742d/68747470733a2f2f636f6465636f762e696f2f67682f53656d616e7469634d6564696157696b692f63616c6c6261636b2d636f6e7461696e65722f67726170682f62616467652e7376673f746f6b656e3d536934354e394d734771)](https://codecov.io/gh/SemanticMediaWiki/callback-container)

A simple object instantiator to lazy load registered callback handlers. Part of the code base has been extracted from [Semantic MediaWiki](https://github.com/SemanticMediaWiki/SemanticMediaWiki/) and is now being deployed as independent library.

Requirements
------------

[](#requirements)

- PHP 8.1 or later

Installation
------------

[](#installation)

The recommended installation method for this library is to add the dependency to your [composer.json](https://getcomposer.org/).

```
{
	"require": {
		"mediawiki/callback-container": "~3.0"
	}
}
```

Usage
-----

[](#usage)

```
use Onoi\CallbackContainer\CallbackContainerFactory;

$callbackContainerFactory = new CallbackContainerFactory();
$containerBuilder = $callbackContainerFactory->newCallbackContainerBuilder();

$containerBuilder->registerCallbackContainer( ... );

$service = $containerBuilder->create( ... );
$service = $containerBuilder->singleton( ... );
```

This [document](/docs/usage.md) contains detailed examples on how to use the `CallbackContainerFactory`and `ContainerBuilder`.

Contribution and support
------------------------

[](#contribution-and-support)

If you want to contribute work to the project please subscribe to the developers mailing list and have a look at the [contribution guidelines](/CONTRIBUTING.md). A list of people who have made contributions in the past can be found [here](https://github.com/SemanticMediaWiki/callback-container/graphs/contributors).

- [File an issue](https://github.com/SemanticMediaWiki/callback-container/issues)
- [Submit a pull request](https://github.com/SemanticMediaWiki/callback-container/pulls)

### Tests

[](#tests)

The library provides unit tests that covers the core-functionality normally run by the \[continues integration platform\]\[travis\]. Tests can also be executed manually using the `composer phpunit` command from the root directory.

Release notes
-------------

[](#release-notes)

### 3.0.0 (2026-03-29)

[](#300-2026-03-29)

- Adds support for php 8.1-8.4
- Requires PHP 8.1+
- Under new composer namespace mediawiki/callback-container

### 2.0.0 (2017-02-18)

[](#200-2017-02-18)

- Requires PHP 5.5+
- Added `CallbackContainerFactory`
- Added `CallbackContainerBuilder::registerAlias`
- Added `CallbackContainerBuilder::registerFromFile` to allow loading callback definitions from a file

### 1.1.0 (2016-04-30)

[](#110-2016-04-30)

- Fixed issue in `registeredObject` for when a singleton override contained a `null` argument
- Deprecated the `CallbackLoader` interface in favour of the `CallbackInstantiator` interface
- Deprecated the `NullCallbackLoader` class in favour of the `NullCallbackInstantiator` class

### 1.0.0 (2015-09-08)

[](#100-2015-09-08)

- Added the `CallbackContainer` and `CallbackLoader` interface
- Added the `DeferredCallbackLoader` and `NullCallbackLoader` implementation

License
-------

[](#license)

[GNU General Public License 2.0 or later](https://www.gnu.org/copyleft/gpl.html).

###  Health Score

43

—

FairBetter than 90% of packages

Maintenance82

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

90d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

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

---

Top Contributors

[![mwjames](https://avatars.githubusercontent.com/u/1245473?v=4)](https://github.com/mwjames "mwjames (21 commits)")[![paladox](https://avatars.githubusercontent.com/u/5727000?v=4)](https://github.com/paladox "paladox (17 commits)")[![hexmode](https://avatars.githubusercontent.com/u/43581?v=4)](https://github.com/hexmode "hexmode (2 commits)")[![jaideraf](https://avatars.githubusercontent.com/u/3636594?v=4)](https://github.com/jaideraf "jaideraf (2 commits)")[![freephile](https://avatars.githubusercontent.com/u/38368?v=4)](https://github.com/freephile "freephile (1 commits)")[![kghbln](https://avatars.githubusercontent.com/u/1104078?v=4)](https://github.com/kghbln "kghbln (1 commits)")

---

Tags

container

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psr/container

Common Container Interface (PHP FIG PSR-11)

10.0k1.0B4.4k](/packages/psr-container)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[php-di/php-di

The dependency injection container for humans

2.8k53.2M1.2k](/packages/php-di-php-di)[dvdoug/boxpacker

An implementation of the 3D (actually 4D) bin packing/knapsack problem (aka creating parcels by putting items into boxes)

6552.9M23](/packages/dvdoug-boxpacker)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[api-platform/metadata

API Resource-oriented metadata attributes and factories

244.5M182](/packages/api-platform-metadata)

PHPackages © 2026

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