PHPackages                             lekoala/kaly-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. lekoala/kaly-di

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

lekoala/kaly-di
===============

06PHPCI passing

Since Mar 18Pushed 1mo ago1 watchersCompare

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

READMEChangelogDependenciesVersions (16)Used By (0)

Kaly DI
=======

[](#kaly-di)

[![Latest Stable Version](https://camo.githubusercontent.com/701dc25930e1aa40aa9484fd5034d9d356aff95afc29ad5a2406a877e34ff68c/687474703a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f6b616c792d64692f76)](https://packagist.org/packages/lekoala/kaly-di) [![Total Downloads](https://camo.githubusercontent.com/6baceef0e9148f41dd53173a9ab57909ea6e1958735f8a9c105483ba409cbb97/687474703a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f6b616c792d64692f646f776e6c6f616473)](https://packagist.org/packages/lekoala/kaly-di) [![License](https://camo.githubusercontent.com/fe2ef8f81f7be3eeaf72be55bce52adae8e89e3a0b84bb85d8f042a30e41d887/687474703a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f6b616c792d64692f6c6963656e7365)](https://packagist.org/packages/lekoala/kaly-di) [![PHP Version Require](https://camo.githubusercontent.com/801f7ca231f85b235db059419feb3e8c9ea1b9767a77e1ca411cef796ba042e8/687474703a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f6b616c792d64692f726571756972652f706870)](https://packagist.org/packages/lekoala/kaly-di)

> Minimalist and Modern Dependency Injection Container for PHP 8.3+

Kaly DI is a lightweight, flexible, and PSR-11 compliant dependency injection (DI) container designed for modern PHP applications. It emphasizes simplicity, performance, and clear code without reliance on attributes or "magic."

Key Features
------------

[](#key-features)

- **PSR-11 Compliance:** Seamlessly interoperable with PHP standards.
- **No Attributes, No Magic:** Keep your code clean and decoupled from the container.
- **Strongly Typed Definitions:** Define dependencies in PHP for full IDE support (autocompletion, refactoring).
- **Advanced Auto-wiring:** Automatic dependency resolution, fine-tunable with resolvers.
- **Performance Focused:** Minimal overhead, designed to be extremely fast.
- **Developer Friendly:** Comprehensive error reporting and development-only assertions.

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

[](#installation)

```
composer require lekoala/kaly-di
```

Quick Start
-----------

[](#quick-start)

```
use Kaly\Di\Container;
use Kaly\Di\Definitions;

// 1. Define dependencies
$definitions = Definitions::create()
    ->set(\PDO::class, new \PDO('sqlite::memory:'));

// 2. Create the container
$container = new Container($definitions);

// 3. Get auto-wired instances
$myObject = $container->get(MyClass::class);
```

Documentation
-------------

[](#documentation)

Detailed guides are available in the `docs/` directory:

- [**Definitions**](./docs/definitions.md): Setting services, binding interfaces, parameters, and callbacks.
- [**Resolvers**](./docs/resolvers.md): Managing complex auto-wiring and type conflicts.
- [**Injector**](./docs/injector.md): Creating fresh instances and invoking callables.
- [**Architecture**](./docs/architecture.md): Internal design, design decisions, and exceptions.

A Note on Assertions
--------------------

[](#a-note-on-assertions)

Kaly DI uses PHP `assert()` for input validation (e.g., checking class existence, definition lock, type compatibility). This is **by design**: these checks run automatically in development (`zend.assertions = 1`) but are disabled in production (`zend.assertions = -1`) for zero overhead.

Ensure your test suite covers your DI configuration to catch mistakes before deployment.

Examples and Testing
--------------------

[](#examples-and-testing)

Check the [unit tests](./tests) for comprehensive usage examples covering all features.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance60

Regular maintenance activity

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 57.8% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/250762?v=4)[Thomas Portelange](/maintainers/lekoala)[@lekoala](https://github.com/lekoala)

---

Top Contributors

[![lekoala](https://avatars.githubusercontent.com/u/250762?v=4)](https://github.com/lekoala "lekoala (37 commits)")[![google-labs-jules[bot]](https://avatars.githubusercontent.com/in/842251?v=4)](https://github.com/google-labs-jules[bot] "google-labs-jules[bot] (27 commits)")

---

Tags

containerdependency-injectiondiphppsr-11

### Embed Badge

![Health badge](/badges/lekoala-kaly-di/health.svg)

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

###  Alternatives

[bertptrs/phpstreams

A streams library for PHP based on the Java 8 Streams API.

883.2k](/packages/bertptrs-phpstreams)[cheprasov/php-parallel

The class allows you to run multiple operations parallel in different processes and send results to the main process. Useful if you need to run multiple independent operations simultaneously, instead of sequential execution, or if you run several independent queries, for example, queries to different data bases

1712.5k5](/packages/cheprasov-php-parallel)

PHPackages © 2026

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