aura/di
Aura.Di is a PSR-11 dependency injection container for PHP 8+ with constructor and setter injection, interface and trait awareness, configurable wiring with inheritance, and support for serialization. Installable via Composer and fully documented.
Illuminate\Container) for non-Laravel projects or microservices.aura/di’s compilation feature.aura/di lacks native support).aura/di if:#[Service], #[Value]).app()->bind()).Events or Symfony’s EventDispatcher).Illuminate\Database or Doctrine).Illuminate/View).aura/di supports it via older versions).symfony/dependency-injection instead).| Use Case | Alternative Packages |
|---|---|
| Laravel-native DI | Illuminate/Container (built-in) |
| Symfony-style DI | symfony/dependency-injection |
| Lightweight DI | php-di/php-di (PHP-DI) |
| Attribute-based DI | php-di/php-di (v6+) or league/container |
| Serialization | php-di/php-di (with php-di/serializer) |
"Aura.Di is a high-performance, lightweight dependency injection container for PHP that replaces Laravel’s built-in system—without sacrificing flexibility. Here’s why it matters:
#[Service]) make DI configurations self-documenting and IDE-friendly, cutting dev time."Aura.Di is a PSR-11-compliant, serializable DI container that’s ideal for:
#[Service], #[Value]) for cleaner code than Laravel’s bind()/singleton().Key Advantages Over Laravel’s Container:
| Feature | Aura.Di | Laravel’s Container |
|---|---|---|
| PSR-11 Compliance | ✅ Yes | ❌ No (Laravel-specific) |
| Serialization | ✅ Yes (cache compiled configs) | ❌ No |
| Attributes (PHP 8+) | ✅ #[Service], #[Value] |
❌ No (uses bind() methods) |
| Lazy Loading | ✅ Advanced (e.g., lazyLazy()) |
❌ Basic |
| Laravel Integration | ❌ No | ✅ Deep (Facades, Service Providers) |
When to Use It:
Migration Path:
aura/di in new projects or non-Laravel modules.Illuminate/Container but adopt aura/di for shared libraries.Risks:
Recommendation: Pilot in a new API or CLI tool to validate performance gains before considering wider adoption."
How can I help you explore Laravel packages today?