PHPackages                             gacela-project/resolver - 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. gacela-project/resolver

Abandoned → [gacela-project/container](/?search=gacela-project%2Fcontainer)Library[PSR &amp; Standards](/categories/psr-standards)

gacela-project/resolver
=======================

A minimalistic container dependency resolver

1.5.0(2w ago)1115.6k—6.7%[1 issues](https://github.com/gacela-project/container/issues)MITPHPPHP &gt;=8.3CI passing

Since Apr 11Pushed 2w ago1 watchersCompare

[ Source](https://github.com/gacela-project/container)[ Packagist](https://packagist.org/packages/gacela-project/resolver)[ Docs](https://gacela-project.com)[ Fund](https://chemaclass.com/sponsor)[ RSS](/packages/gacela-project-resolver/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (10)Dependencies (23)Versions (26)Used By (0)

Gacela Container
================

[](#gacela-container)

 [ ![GitHub Build Status](https://github.com/gacela-project/container/workflows/CI/badge.svg) ](https://github.com/gacela-project/container/actions) [ ![Latest Version](https://camo.githubusercontent.com/ba02208057e41f934177b2a53ea0274fb6edc3c53d90d31b63722b9cae553a5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f676163656c612d70726f6a6563742f636f6e7461696e65722e737667) ](https://packagist.org/packages/gacela-project/container) [ ![PHP Version Require](https://camo.githubusercontent.com/1112478f70cb1508f97d9407d74e222d5e5f2c11f833b75d88a65d5214aee177/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f676163656c612d70726f6a6563742f636f6e7461696e65722e737667) ](https://packagist.org/packages/gacela-project/container) [ ![Psalm Type-coverage Status](https://camo.githubusercontent.com/a6654b118fb31475cfbcaec921a40cddf3d14726de40add51cb04fbefd6de103/68747470733a2f2f73686570686572642e6465762f6769746875622f676163656c612d70726f6a6563742f636f6e7461696e65722f636f7665726167652e737667) ](https://shepherd.dev/github/gacela-project/container) [ ![MIT Software License](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667) ](https://github.com/gacela-project/container/blob/main/LICENSE)

A minimalistic, PSR-11 compliant dependency injection container with automatic constructor injection and zero configuration.

Features
--------

[](#features)

- 🚀 **Zero Configuration**: Automatic constructor injection without verbose setup
- 🔄 **Circular Dependency Detection**: Clear error messages when dependencies form a loop
- 📦 **PSR-11 Compliant**: Standard container interface for interoperability
- ⚡ **Performance Optimized**: Built-in caching, warmup, a compiled cache that skips reflection, and one plan cache shared across sibling containers
- 🧩 **Fluent Registration**: Register bindings after construction with `bind()`, `singleton()` and `lazy()`
- 🌱 **Scopes**: Child containers that inherit registration without copying it, for per-request lifetimes
- 🎁 **Typed Resolution**: `make()` returns a typed instance; `getOrFail()` never returns `null`
- 🧵 **Tags**: Group services under a tag and resolve them lazily, as a list or as a keyed map
- 🧭 **Contextual Bindings**: `when()` scopes a dependency — or a scalar — to the classes that ask for it
- 📄 **Definitions as Data**: Ship and override wiring as arrays, PHP or JSON files with `load()`/`loadFile()`
- 🪝 **Resolution Hooks**: `afterResolving()` callbacks run once an id is built
- 🔍 **Introspection**: Debug and inspect container state easily
- 🎯 **Type Safe**: Requires type hints for reliable dependency resolution
- 🏷️ **PHP 8 Attributes**: Declarative configuration with `#[Inject]`, `#[Singleton]`, `#[Factory]`, and `#[Lazy]`

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

[](#installation)

```
composer require gacela-project/container
```

Requires PHP &gt;= 8.3.

Hello World
-----------

[](#hello-world)

```
use Gacela\Container\Container;

class Greeter {
    public function __construct(private Clock $clock) {}

    public function greet(): string {
        return 'Hello World at ' . $this->clock->now();
    }
}

class Clock {
    public function now(): string {
        return date('H:i:s');
    }
}

// Zero configuration — dependencies are auto-wired from type hints
$container = new Container();
$greeter = $container->make(Greeter::class);

echo $greeter->greet();
```

Need interfaces, singletons, attributes, or a compiled cache? See the docs below.

How it compares
---------------

[](#how-it-compares)

Gacela[Pimple](https://github.com/silexphp/Pimple)[Laravel](https://github.com/illuminate/container)[PHP-DI](https://php-di.org)[Symfony](https://symfony.com/doc/current/service_container.html)PSR-11✅wrapper✅✅✅Autowiring with zero config✅❌✅✅needs configFramework-independent✅✅pulls `illuminate/contracts`✅✅Lifetimes as attributes`#[Singleton]` `#[Factory]` `#[Lazy]`❌❌`#[Inject]` only`#[Autoconfigure]`Property injection✅ `#[Inject]`❌❌✅via configLazy services✅ native lazy objects (PHP 8.4+), attribute or `lazy()`, no proxy class❌❌✅ via proxy library✅Compiled resolution✅ plans + generated factories❌❌✅✅Reflection shared across sibling containers✅ `PlanCache`, in-process❌❌via APCu cachen/a — dumped onceChild/scope containers✅ inherits without copying❌❌❌❌Contextual bindings✅❌✅definitions✅Tags✅ list or keyed map❌✅❌✅Resolution hooks✅ `afterResolving()`❌✅❌❌Invoke any callable✅ `resolve()`❌✅ `call()`✅ `call()`❌Circular dependencies✅ named exception + path❌✅✅✅ at compile timeIntrospection✅ `stats()`, dependency tree, `compileReport()`, typo hints❌❌limited✅ via consoleArray access✅✅✅❌❌Definitions as data✅ arrays, PHP + JSON + YAML files❌❌✅✅YAML definition files✅ optional, via `symfony/yaml` — never a hard dependency❌❌✅✅XML definition files❌ [by design](https://github.com/gacela-project/container/issues/139) — parse it and `load()` the array❌❌❌✅Build-time validation✅ `validate()`, `gacela-container validate`❌❌❌✅ via compiler passesCompiler passes / extensions❌ [by design](https://github.com/gacela-project/container/issues/140) — packages [expose definitions](docs/cookbook.md#let-a-package-register-its-own-services) instead❌❌❌✅**Use this if** you want Pimple's footprint with real autowiring, or Laravel's container API without Laravel — plus lazy services, per-request scopes, and a compiled cache that skips reflection entirely.

**Look elsewhere if** you need XML definitions or compiler-pass style extension points. Both are deliberate boundaries rather than a backlog — XML has no canonical mapping to a definition array short of inventing a schema ([\#139](https://github.com/gacela-project/container/issues/139)), and passes operate on a definition set an autowiring container mostly does not have ([\#140](https://github.com/gacela-project/container/issues/140)) — the two things passes are actually reached for are covered instead: `validate()` gives the build-time feedback, and a package registers services by exposing definitions for `load()`. Each issue records the reasoning and what would change it. YAML *is* supported, as a `suggest` — install `symfony/yaml` and `loadFile()` reads it; the runtime requirement is still `psr/container` alone.

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

[](#documentation)

GuideWhat's inside[Getting Started](docs/getting-started.md)Installation, basic usage, how resolution works[Bindings &amp; Registration](docs/bindings.md)Constructor bindings, `bind()`/`singleton()`, contextual bindings, aliasing[Definitions as Data](docs/definitions.md)`load()`/`loadFile()`: wiring from arrays, PHP and JSON files[Resolving Services](docs/resolution.md)`get()`, `make()`, `getOrFail()`, `resolve()`, transient vs. shared[PHP 8 Attributes](docs/attributes.md)`#[Inject]`, `#[Singleton]`, `#[Factory]`[Managing Services](docs/services.md)Factories, extending, protecting closures, introspection[Scopes](docs/scopes.md)Child containers: inherited registration, per-request lifetimes[Performance &amp; Compilation](docs/performance.md)`warmUp()`, compiled container cache[Cookbook](docs/cookbook.md)Recipes: testing, config, plugins, decorating, debugging[Error Handling](docs/error-handling.md)Every exception, what causes it, how to fix it[Best Practices](docs/best-practices.md)Recommended patterns[API Reference](docs/api-reference.md)Full method, static, and attribute reference[Backward Compatibility](docs/backward-compatibility.md)What semver covers here, and what it does not[Upgrade Guide](UPGRADE.md)Migrating from 0.10.0 to 1.0.0 — the only breaking bump so farReal-World Example
------------------

[](#real-world-example)

See how it's used in the [Gacela Framework](https://github.com/gacela-project/gacela/blob/main/src/Framework/ClassResolver/AbstractClassResolver.php#L161).

Testing
-------

[](#testing)

```
composer test          # Run tests
composer quality       # Run static analysis
composer test-coverage # Generate coverage report
```

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) file for details.

###  Health Score

56

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 91% 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 ~60 days

Recently: every ~1 days

Total

21

Last Release

16d ago

Major Versions

0.10.0 → 1.0.02026-07-26

PHP version history (3 changes)0.1.0PHP ^8.0, &lt;8.3

0.6.0PHP &gt;=8.1

1.0.0PHP &gt;=8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/3d166420c6770c5941e10bd68b2d26501eabb432e280d8e6eba0a344bcc1e5ae?d=identicon)[Chemaclass](/maintainers/Chemaclass)

![](https://avatars.githubusercontent.com/u/6381924?v=4)[Jesus Valera Reales](/maintainers/JesusValeraDev)[@JesusValeraDev](https://github.com/JesusValeraDev)

---

Top Contributors

[![Chemaclass](https://avatars.githubusercontent.com/u/5256287?v=4)](https://github.com/Chemaclass "Chemaclass (232 commits)")[![JesusValeraDev](https://avatars.githubusercontent.com/u/6381924?v=4)](https://github.com/JesusValeraDev "JesusValeraDev (18 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![antonio-gg-dev](https://avatars.githubusercontent.com/u/13595197?v=4)](https://github.com/antonio-gg-dev "antonio-gg-dev (1 commits)")[![khru](https://avatars.githubusercontent.com/u/6353105?v=4)](https://github.com/khru "khru (1 commits)")

---

Tags

containerdependency-resolvergacelaphpresolverphpcontainerresolvergacela

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/gacela-project-resolver/health.svg)

```
[![Health](https://phpackages.com/badges/gacela-project-resolver/health.svg)](https://phpackages.com/packages/gacela-project-resolver)
```

###  Alternatives

[gacela-project/container

A minimalistic container dependency resolver

11169.5k6](/packages/gacela-project-container)

PHPackages © 2026

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