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

ActiveLibrary

weebel/container
================

A simple and minimal but yet powerful container

0.1.2(3y ago)071MITPHP

Since Jan 20Pushed 3y agoCompare

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

READMEChangelog (3)Dependencies (7)Versions (4)Used By (1)

container
=========

[](#container)

A simple and minimal but yet powerful container

Installing
==========

[](#installing)

Using composer:

```
composer require weebel/container
```

Usage
=====

[](#usage)

You must make a container instance using the following command:

```
$container = \Weebel\Container\Container::getInstance();
```

Suppose that we have a service called App\\UserBuilder:

```
namespace App;

class UserBuilder
{
    public function __construct(public UserRepositoryInterface $userRepository, public string $type)
    {

    }

}
```

Now setting instances:

```
$container->set('user_builder', new App\UserBuilder());
$container->set('user_builder', fn()=>new App\UserBuilder());
```

For getting a service from the container by id:

```
$container->get('user_builder');
$container->get(App\UserBuilder::class);
```

Setting aliases:

```
$container->alias('user_builder', App\UserBuilder::class);
$container->alias(App\UserBuilderInterface::class, App\UserBuilder::class);
```

- Remember when defining an alias, the result of the both of the keys are exactly the same which means

Defining multiple instances or tags for service

```
$container->set('user_builder', App\UserBuilder::class);
$container->set('admin_user_builder', App\UserBuilder::class);
```

Setting arguments for an instance or tag

```
$container->addArgument('admin_user_builder', 'type', 'admin');
$container->addArgument(App\UserBuilder::class, 'type', 'normal');
```

If you want to use a tag as an argument you must use '@' before the name of it. Otherwise, it would be considered as a string

```
$container->set('admin_repository', AdminRepository::class);
$container->addArgument(App\UserBuilder::class, 'userRepository', '@admin_repository');
$container->addArgument(App\UserBuilder::class, 'userRepository', fn(\Psr\Container\ContainerInterface $container)=> $container->get(AdminRepository::class));
$container->addArgument(App\UserBuilder::class, 'userRepository', '@'.AdminRepository::class);
```

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Total

3

Last Release

1214d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/691322b900db6b86519a6d891a39ea59824fc8cb95330303933c81be13a8dbb2?d=identicon)[mohamadreza89](/maintainers/mohamadreza89)

---

Top Contributors

[![mohamadrezapishdad](https://avatars.githubusercontent.com/u/34881789?v=4)](https://github.com/mohamadrezapishdad "mohamadrezapishdad (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[pimple/pimple

Pimple, a simple Dependency Injection Container

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

Flow Application Framework

862.0M451](/packages/neos-flow)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[internal/dload

Downloads binaries.

98142.7k10](/packages/internal-dload)[symfony/json-streamer

Provides powerful methods to read/write data structures from/into JSON streams.

14440.0k8](/packages/symfony-json-streamer)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)

PHPackages © 2026

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