PHPackages                             mulertech/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. mulertech/container

ActiveLibrary

mulertech/container
===================

The MulerTech dependency injection container

1.1.1(2y ago)03751MITPHPPHP &gt;=8.2CI passing

Since Oct 26Pushed 1mo ago1 watchersCompare

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

READMEChangelog (9)Dependencies (3)Versions (12)Used By (1)

Container
=========

[](#container)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/9b4f258affb4b66512ebc9d53347746a59b7d0b252893030f3c154f90dbcd9fa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d756c6572746563682f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/container)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5d2fa3cb0c46895ce34463bddce5aa5cb13b9d985907cce494de56c8e5c2bf43/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f636f6e7461696e65722f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mulertech/container/actions/workflows/tests.yml)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/3be4295977237fea3ac307e5d98691912ec49804ff2fe3a450deaa050659d377/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f636f6e7461696e65722f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/mulertech/container/actions/workflows/phpstan.yml)[![GitHub Security Action Status](https://camo.githubusercontent.com/f3db630d71db5063a3fa57007bff80d930572ed51a35164dc52a98e7dedf7016/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f636f6e7461696e65722f73656375726974792e796d6c3f6272616e63683d6d61696e266c6162656c3d7365637572697479267374796c653d666c61742d737175617265)](https://github.com/mulertech/container/actions/workflows/security.yml)[![Total Downloads](https://camo.githubusercontent.com/c820fa3e847efc129ebdbea140fffcbed3cd6dcbf7ae8fdf47b07055a0658f5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d756c6572746563682f636f6e7461696e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/container)[![Test Coverage](https://raw.githubusercontent.com/mulertech/container/badge/badge-coverage.svg)](https://packagist.org/packages/mulertech/container)

---

The MulerTech dependency injection container

---

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

[](#installation)

###### *Two methods to install Application package with composer :*

[](#two-methods-to-install-application-package-with-composer-)

1.

Add to your "**composer.json**" file into require section :

```
"mulertech/container": "^1.0"

```

and run the command :

```
php composer.phar update

```

2.

Run the command :

```
php composer.phar require mulertech/container "^1.0"

```

---

Usage
-----

[](#usage)

###### *Initialize the container (you can give the definitions into this construct) :*

[](#initialize-the-container-you-can-give-the-definitions-into-this-construct-)

```
$container = new Container();
or
$container = new Container($definitions);

```

```
//definitions file :
return [
new \MulerTech\Container\Definition(\Psr\Http\Server\RequestHandlerInterface::class, \MulerTech\Application\RequestHandler::class),
new \MulerTech\Container\Definition(\MulerTech\Form\Validators\MaxLengthValidator::class, null, [], true)
];

```

###### *Get simple class :*

[](#get-simple-class-)

```
$container->get(Foo::class);

```

###### *Add a class with its interface (you can get this class with the interface class name) :*

[](#add-a-class-with-its-interface-you-can-get-this-class-with-the-interface-class-name-)

```
$container->add(FooInterface::class, Foo::class);

$fooClass = $container->get(FooInterface::class);

```

###### *Add a class with arguments :*

[](#add-a-class-with-arguments-)

```
$container->add(FooInterface::class, Foo::class, ['argumentName' => 'argument value']);

```

###### *Set parameters and get it :*

[](#set-parameters-and-get-it-)

```
$container->setParameter('parameter', 'a value');

echo $container->getParameter('parameter'); // a value

```

###### *Use parameters into class construct arguments :*

[](#use-parameters-into-class-construct-arguments-)

```
$container->setParameter('parameter', 'a value');

$container->add(FooInterface::class, Foo::class, ['argumentName' => '%parameter%']);

```

###### *Load yaml files parameters into container :*

[](#load-yaml-files-parameters-into-container-)

```
$container = new Container();
$loader = new Loader();
$loader
    ->setFileList(['./path_to_files/file1.yaml', './path_to_files/file2.yaml'])
    ->setLoader(YamlLoader::class)
    ->loadParameters($container);

```

###### *Set parameters with env value :*

[](#set-parameters-with-env-value-)

```
#env file :
key=value

```

```
$container = new Container();
$container->setParameter('parameter', 'env(key)');
echo $container->getParameter('parameter'); // value

```

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance60

Regular maintenance activity

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 87% 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 ~64 days

Recently: every ~75 days

Total

9

Last Release

784d ago

PHP version history (4 changes)v1.0.2PHP ^7.3

v1.0.5PHP &gt;=7.3

v1.0.6PHP ^7.4

v1.1.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/357d309912bbc5318d9877d1369987d2390c8e034b637e9f20671c28b09b5119?d=identicon)[mulertech](/maintainers/mulertech)

---

Top Contributors

[![mulertech](https://avatars.githubusercontent.com/u/57788787?v=4)](https://github.com/mulertech "mulertech (40 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

open-source

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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