NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #2989 most downloaded on Packagist
Guice style dependency injection framework
Last release 1 months ago
30 Aug 2026
Release timing varies
gaps range from 3 weeks to 12 months
Rarely documented
notes for 11 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
103 releases · first in 2013
MethodInvocationProvider keeps the invocation only while an intercepted method runs: the slot is cleared on return and nested interceptions each see t
MethodInvocationProvider keeps the invocation only while an intercepted method runs: the slot is cleared on return and nested interceptions each see their own invocation, and concurrent coroutine interceptions are isolated from each other (#349).Write bindings.md at composition time: the injector records how the container was composed — every binding with its provenance — via BindingLog , Bind
bindings.md at composition time: the injector records how the container was composed — every binding with its provenance — via BindingLog, BindingEvent, and the core Ray\Di\BindingsMarkdown renderer (#336).Ray\Di\ModuleVisitorInterface as the stable route for tools to visit a module's composed container via AbstractModule::accept() (#336).Ray\Bindings\Bindings, Ray\Bindings\BindingsHtml, Ray\Bindings\BindingsMarkdown, and the bin/bindings-html command now live in the standalone ray/bindings package (composer require --dev ray/bindings). These APIs were introduced in 2.22.1; the composition-time bindings.md above remains in core (#336).@PostConstruct throws (#346).Full Changelog: https://github.com/ray-di/Ray.Di/blob/2.x/CHANGELOG.md
One column per quarter.
bindings.md at composition time: the injector records how the container was composed — every binding with its provenance — via BindingLog, BindingEvent, and the core Ray\Di\BindingsMarkdown renderer (#336).Ray\Di\ModuleVisitorInterface as the stable route for tools to visit a module's composed container via AbstractModule::accept() (#336).Ray\Bindings\Bindings, Ray\Bindings\BindingsHtml, Ray\Bindings\BindingsMarkdown, and the bin/bindings-html command now live in the standalone ray/bindings package (composer require --dev ray/bindings). These APIs were introduced in 2.22.1; the composition-time bindings.md above remains in core (#336).@PostConstruct throws (#346).Non-instantiable concrete classes (e.g. private constructors) are no longer just-in-time bound. Requesting an unbound non-instantiable class fails wit
Ray\Di\Exception\Unbound instead of a bare PHP Error (Call to private ...::__construct()), which became more visible after NewInstance switched to language-level new in 2.21 (#335).Just-in-time binding of public instantiable concrete classes at the top level is unchanged.
Unbound instead of a bare PHP Error after language-level new in NewInstance (#335).Mark InvalidContext , InvalidToConstructorNameParameter , and the base Ray\Di\Exception as deprecated and relocate them to src-deprecated/ ; none has…
Ray\Bindings\Bindings snapshots for rendering it as Markdown or HTML — collected explicitly with $module->accept(new Bindings()) (#323, #331).Ray\Bindings\BindingsHtml viewer and the bin/bindings-html command (#325, #330).InvalidContext, InvalidToConstructorNameParameter, and the base Ray\Di\Exception as deprecated and relocate them to src-deprecated/; none has been thrown since earlier releases tightened the related method signatures (#329).null arguments during assisted injection (#328).Full Changelog: 2.20.0...2.22.1
Release 2.21.0, 2.21.1 and 2.22.0 were dismissed.
Add NoHint exception for parameters without type hints or binding names
NoHint exception for parameters without type hints or binding namesUnbound error messages with better formattingFull Changelog: 2.19.3...2.20.0
Enhanced BcParameterQualifier to support method-level Qualifier attributes on constructors
…methods, and improves naming consistency for deprecated code.
This release adds backward compatibility for method-level InjectInterface+Qualifier attributes on single-parameter setter methods, and improves naming consistency for deprecated code.
New: BcParameterQualifier
InjectInterface+Qualifier attributes to parameters for single-parameter setters#[FakeLogDbInject]Attribute::TARGET_PARAMETER (distinguishes from Provider pattern)src-deprecated/di/ and marked as @deprecatedExample (now works):
#[FakeLogDbInject] // InjectInterface + Qualifier
public function setDb(ExtendedPdoInterface $pdo) { }Recommended Modern Approach:
#[Inject]
public function setDb(#[FakeLogDb] ExtendedPdoInterface $pdo) { }Naming Improvements:
LegacyStringParser → BcStringParser for consistencyBc prefix (Backward Compatibility)Technical Details:
Ray\Di\BcParameterQualifier with getNames() methodRay\Di\LegacyStringParser → Ray\Di\BcStringParserThis ensures compatibility with packages like Ray.AuraSqlModule that use method-level qualifier attributes.
Full Changelog: 2.19.1...2.19.2
This format is now handled by the new LegacyStringParser class in src-deprecated/di/
This release restores backward compatibility for the string format in toConstructor() method that was accidentally removed in 2.19.0 (commit da864a5).
Restored Support:
toConstructor(ClassName::class, 'param=name,param2=name2')LegacyStringParser class in src-deprecated/di/@deprecated - prefer using parameter-level attributes or array formatRecommended Modern Approaches:
#[Named('name')] on constructor parameterstoConstructor(ClassName::class, ['param' => 'name'])Technical Details:
Ray\Di\LegacyStringParser for parsing legacy string formatRay\Di\Name to delegate string parsing to LegacyStringParserThis fix ensures that existing code using Ray.AuraSqlModule and other packages relying on the string format will continue to work.
Full Changelog: 2.19.0...2.19.1
Move ray/compiler to suggested dependency ( #304 ) ray/compiler is no longer required. Ray.Di only uses Ray\Aop\Compiler from ray/aop .
Move ray/compiler to suggested dependency (#304)
ray/compiler is no longer required. Ray.Di only uses Ray\Aop\Compiler from ray/aop.
Optimize codebase for PHP 8.2+ (#305)
Modernized code with readonly properties, constructor property promotion, and improved type declarations.
43 files changed: +166 -299 lines
AnnotationException referencesBug fix : Handle missing dependencies in setter methods with #[Inject(optional: true)] by @koriym in #292
Full Changelog: 2.17.2...2.18.0
Serializable provider provider by @koriym in #291
PDOをプロパティに持つクラスは通常シリアライズができませんが、以下のようにPDOではなくPDOのプロバイダーを注入することによりシリアライズが可能になります。
Classes that have PDO as a property cannot normally be serialized, but they can be serialized by injecting a lazy object as follows.
class LazyPdo
{
private PDO $pdo;
public function __construct(
/** ProviderInterface<PDO> */
#[Set(PDO::class)] private ProviderInterface $pdoProvider
) {
$this->pdoProvider = $pdoProvider;
$this->initialize($pdoProvider);
}
public function initialize(ProviderInterface $pdoProvider)
{
$this->pdo = $this->pdoProvider->get();
}
public function __serialize(): array
{
return [
'pdoProvider' => $this->pdoProvider
];
}
public function __unserialize(array $data): void
{
$this->pdoProvider = $data['pdoProvider'];
$this->initialize($data['pdoProvider']);
}
}Full Changelog: 2.17.1...2.17.2
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →