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

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

viloveul/container
==================

Container of Viloveul. Just like service locator

v1.0.10(7y ago)11892MITPHPPHP ~7.0

Since Dec 28Pushed 6y ago1 watchersCompare

[ Source](https://github.com/viloveul/container)[ Packagist](https://packagist.org/packages/viloveul/container)[ Docs](http://www.viloveul.com)[ RSS](/packages/viloveul-container/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (3)Versions (14)Used By (2)

[![Build Status](https://camo.githubusercontent.com/b25ed0e0366ec4f11a7b81301d0413cb5d90e0073c163ec54796157ff6ef913d/68747470733a2f2f7472617669732d63692e636f6d2f76696c6f7665756c2f636f6e7461696e65722e737667)](https://travis-ci.com/viloveul/container)[![Total Downloads](https://camo.githubusercontent.com/f93d608fd28b156ab536139897db6397d0bbb3cc8c26ba64d598ba9dcc62fc68/68747470733a2f2f706f7365722e707567782e6f72672f76696c6f7665756c2f636f6e7461696e65722f642f746f74616c2e737667)](https://packagist.org/packages/viloveul/container)[![Latest Stable Version](https://camo.githubusercontent.com/758e94b8a8332b6f69678c7bb78fba41ee7cb1feec564eb3577b5cfb313b3f8a/68747470733a2f2f706f7365722e707567782e6f72672f76696c6f7665756c2f636f6e7461696e65722f762f737461626c652e737667)](https://packagist.org/packages/viloveul/container)

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

[](#installation)

make sure your php version &gt; 7.0

```
composer require viloveul/container
```

How
---

[](#how)

```
require __DIR__ . '/vendor/autoload.php';

$container = Viloveul\Container\ContainerFactory::instance();

class YourClassA
{
	public $name = 'Hello';
}

class YourClassB
{
	public $name = null;

	public function __construct(YourClassA $a)
	{
		$this->name = $a->name;
	}
}

$result = $container->make(YourClassB::class);

var_dump($result);
```

or

```
require __DIR__ . '/vendor/autoload.php';

$container = new Viloveul\Container\Container();

interface EntityInterface
{
}

class YourClassA implements EntityInterface
{
	public $name = 'Hello';
}

class YourClassB
{
	public $name = null;

	public function __construct(EntityInterface $entity)
	{
		$this->name = $entity->name;
	}
}

$container->set(EntityInterface::class, YourClassA::class);

$result = $container->make(YourClassB::class);

var_dump($result);

$entity = $container->get(EntityInterface::class);

var_dump($entity);

$container->set('world', function(EntityInterface $entity) {
	return new YourClassB($entity);
});

$world = $container->get('world');

var_dump($world);

$maybe = $container->invoke(function(EntityInterface $entity) {
	return $entity;
});

var_dump($maybe);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Total

12

Last Release

2533d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/609a03f1a38d80aa5cf333dd556cb748371dbcbc880f3c580ecea72ff0fb228b?d=identicon)[zafex](/maintainers/zafex)

---

Top Contributors

[![zafex](https://avatars.githubusercontent.com/u/12587685?v=4)](https://github.com/zafex "zafex (37 commits)")

---

Tags

containerphppsrviloveulviloveul-frameworkcontainerlibrarycomponentzafexviloveulfajrulaz

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

2.7k130.5M1.4k](/packages/pimple-pimple)

PHPackages © 2026

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