PHPackages                             hydrakit/php-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. [Framework](/categories/framework)
4. /
5. hydrakit/php-di

ActiveLibrary[Framework](/categories/framework)

hydrakit/php-di
===============

PHP-DI container adapter for the Hydra PHP framework

v0.2.0(1mo ago)051MITPHPPHP &gt;=8.2

Since Jul 9Pushed 1mo agoCompare

[ Source](https://github.com/hydra-foundation/php-di)[ Packagist](https://packagist.org/packages/hydrakit/php-di)[ RSS](/packages/hydrakit-php-di/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (3)Versions (2)Used By (1)

Hydra PHP-DI
============

[](#hydra-php-di)

The one place the framework names a concrete dependency-injection engine.

`hydrakit/core` defines the `ContainerInterface` the framework resolves services through — `get`/`has`/`singleton`/`instance`/`bound` — but names no DI engine. This package is the default adapter that backs that contract with [PHP-DI](https://php-di.org/). An app that prefers another engine writes its own adapter against the same interface, and this package never loads — exactly as `hydrakit/nyholm` is the swappable PSR-7 adapter.

Usage
-----

[](#usage)

The app's composition root builds the container and hands it to the kernel:

```
use Hydra\PhpDi\Container;

$container = Container::create();          // wraps a fresh PHP-DI container

Kernel::application($container, $environment)
    ->register(new NyholmServiceProvider)
    ->register(new SignerServiceProvider)
    ->register(new HttpServiceProvider(/* ... */))
    ->register(new AppServiceProvider);
```

`Container::create()` is the common case, so the composition root needn't name `DI\Container` itself. To tune PHP-DI (definitions, compilation, proxies), build the underlying container yourself and inject it:

```
$phpdi = (new \DI\ContainerBuilder())->enableCompilation(__DIR__ . '/cache')->build();
$container = new Container($phpdi);
```

Binding semantics
-----------------

[](#binding-semantics)

PHP-DI caches every resolved entry, so a binding is inherently shared:

- `singleton($abstract, $concrete)` — a class-string is autowired; a callable is used as a factory. This is the only binding kind; there is no transient counterpart (per the contract's documented YAGNI stance).
- `instance($abstract, $object)` — register an already-constructed object.
- `bound($abstract)` — whether the container can **resolve** the abstract, which for an autowiring engine includes any instantiable class, not only explicitly registered ones. Use it as a capability check, never as evidence a provider ran.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance90

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

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

Unknown

Total

1

Last Release

47d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a947272da0bf1d7d6326b4fbf6ddb8049977cbdbe333d0d1282dbb6f5927dfdf?d=identicon)[whleucka](/maintainers/whleucka)

---

Top Contributors

[![whleucka](https://avatars.githubusercontent.com/u/71740767?v=4)](https://github.com/whleucka "whleucka (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hydrakit-php-di/health.svg)

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

###  Alternatives

[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k39.6k](/packages/matomo-matomo)[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k17.3k100](/packages/elgg-elgg)[infinum/eightshift-libs

WordPress libs developed by Eightshift team to use in modern WordPress.

63127.2k3](/packages/infinum-eightshift-libs)[drupal-code-builder/drupal-code-builder

Code generator for Drupal

27257.3k1](/packages/drupal-code-builder-drupal-code-builder)[duxweb/dux-lite

The lightweight framework based on slim php

161.0k9](/packages/duxweb-dux-lite)

PHPackages © 2026

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