PHPackages                             bigbit/smart-di - 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. bigbit/smart-di

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

bigbit/smart-di
===============

SmartContainer evolved from ODDIN ExampleContainer

v2.1.0(6y ago)027↓85.7%2MITPHPPHP ^7.4.0CI failing

Since Aug 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/andrzejenne/smart-di)[ Packagist](https://packagist.org/packages/bigbit/smart-di)[ RSS](/packages/bigbit-smart-di/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (6)Versions (10)Used By (2)

smart-di
========

[](#smart-di)

SmartContainer evolved from ODDIN example.

Dependencies for php7.4

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

[](#installation)

composer require bigbit/smart-di

Usage
-----

[](#usage)

Creating instance using static createDefault factory method.

```
use Symfony\Component\Cache\Simple\ArrayCache;

/** @var Psr\SimpleCache\CacheInterface */
$cache = new ArrayCache();

$container = SmartContainer::createDefault($cache);
```

Overriding service definitions
------------------------------

[](#overriding-service-definitions)

By default, all definitions are discovered automatically.

To force a service factory callable into container, use define method.

```
$container->define(SomeClass::class, function(ContainerInterface $container) {
    return new SomeClass(
        $container->get(SomeDependency::class)
    );
});
```

Adding primitive dependencies
-----------------------------

[](#adding-primitive-dependencies)

In some circumstances, service requires primitive value in constructor.

SomeClass service can look like this.

```
class SomeClass {
    public function __construct(SomeService $service, string $primitive, $mixed) { }
}
```

Adding primitive by value or callable.

```
use BigBIT\SmartDI\Interfaces\SmartContainerInterface;
use Psr\Container\ContainerInterface;

/** @var SmartContainerInterface $container */
$container->definePrimitive(SomeClass::class, 'primitive', 'someValue');
$container->definePrimitive(SomeClass::class, 'mixed',
    function(ContainerInterface $container) {
        return 'anotherValue';
    }
);
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

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

Total

9

Last Release

2282d ago

Major Versions

1.0.x-dev → v2.0.02019-12-02

v2.0.1 → 3.0.x-dev2020-03-31

PHP version history (2 changes)v1.0.0PHP ^7.2.0

v2.0.0PHP ^7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/30d24aafad042ca1644f0599dbb6dea333601b666179b4e690bf4e357e70e685?d=identicon)[lamasutra](/maintainers/lamasutra)

---

Top Contributors

[![andrzejenne](https://avatars.githubusercontent.com/u/15650034?v=4)](https://github.com/andrzejenne "andrzejenne (8 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/bigbit-smart-di/health.svg)

```
[![Health](https://phpackages.com/badges/bigbit-smart-di/health.svg)](https://phpackages.com/packages/bigbit-smart-di)
```

###  Alternatives

[symfony/dependency-injection

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

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

The Illuminate Contracts package.

706127.7M12.7k](/packages/illuminate-contracts)[illuminate/container

The Illuminate Container package.

31180.7M2.3k](/packages/illuminate-container)[symfony/type-info

Extracts PHP types information.

20062.9M225](/packages/symfony-type-info)[ecotone/ecotone

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

562565.8k42](/packages/ecotone-ecotone)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751284.3k37](/packages/civicrm-civicrm-core)

PHPackages © 2026

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