NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #3546 most downloaded on Packagist
A dependency injection compiler for Ray.Di
Last release 1 months ago
14 Aug 2026
Release timing varies
gaps range from 2 weeks to 9 months
Rarely documented
notes for 10 of 59 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
59 releases · first in 2015
Accept phar:// script directories — realpath() cannot resolve stream URIs, so validation falls back to is_dir() / is_readable() ; AOT scripts can now
phar:// script directories — realpath() cannot resolve stream URIs, so validation falls back to is_dir()/is_readable(); AOT scripts can now boot from inside a phar archive [#144]Eager singleton warm-up for coroutine runtimes
Compiler now writes singletons.json alongside the compiled scripts, and CompiledInjector::warmup() instantiates every listed singleton eagerly:
$injector = new CompiledInjector($scriptDir);
$injector->warmup(); // call once at worker startupIn coroutine runtimes (Swoole, OpenSwoole), lazy singleton initialization can race when construction yields, producing duplicate instances. Calling warmup() before concurrent request handling removes that window. Standard PHP-FPM workers process one request at a time, so no warm-up is required there. [#137] [#140]
A singleton whose construction needs a caller-supplied injection point is a first-consumer-wins binding — under coroutines, which consumer wins is nondeterministic. compile() now rejects such bindings with SingletonRequiresInjectionPoint (the message is the dependency index). Use prototype scope instead. [#140]
Generated scripts also emit $ip ?? throw new InjectionPointNotAvailable, so resolving an injection-point binding without a consumer context fails with a dedicated exception instead of a bare TypeError.
// prototype / // singleton scope comments [#140]setContext() rolls back the provisional cache entry instead of leaving a half-initialized singleton [#138]compile() now fails — change the binding to prototype scope.warmup(); it throws SingletonsFileNotFound when singletons.json is missing.One column per quarter.
CompiledInjector::warmup() — eagerly instantiates every singleton listed in the compiler-generated singletons.json, closing the lazy-initialization race window in coroutine runtimes (Swoole, OpenSwoole); call once at worker start. Not needed under PHP-FPM [#137] [#140]SingletonRequiresInjectionPoint exception — compile() rejects singletons whose construction needs a caller-supplied injection point (first-consumer-wins bindings); use prototype scope instead [#140]InjectionPointNotAvailable exception — resolving an injection-point binding without a consumer context fails with a dedicated exception instead of a bare TypeError [#140]SingletonsFileNotFound exception — warmup() fails loudly when the singleton metadata is missing (recompile) [#140]// prototype / // singleton scope comments; the $singletons write line already expresses the scope [#140]setContext() rolls back the provisional cache entry instead of leaving a half-initialized singleton behind [#138]Deprecate ScriptFileNotFound exception (kept for BC) [ #134 ]
file_exists() guard on the hot path in prototype()/singleton() — an OPcache-cached require performs no filesystem access, so the guard was the only stat() syscall left [#134]prototype()/singleton() now require the script directly without try/catch; a missing compiled script is a build invariant violation that surfaces as PHP 8's native catchable Error [#134]ScriptFileNotFound exception (kept for BC) [#134]realpath() call in CompiledInjector::getInstance() [#134]#[ScriptDir] to __DIR__ instead of baking the compile-time absolute path [#136]docs/performance.md) covering OPcache prerequisites and benchmarking methodology [#134]demo/benchmark/ [#134]--memory-limit=256M to phpstan in composer scriptsFix typo in variable and directory name in DependencySaver ( qualifer → qualifier ) #131
Remove deprecated Doctrine annotations
Additional array type handling improvements
Full Changelog: 1.12.2...1.12.3
Fix array handling in CompileVisitor to serialize arrays instead of using var_export() [ #125 ]
[new Object(), 'method'])Full Changelog: 1.12.1...1.12.2
Remove incorrect @deprecated annotation from DiCompileModule
Move Code4Dependency to src-deprecated and exclude from Psalm
override() in Compiler and remove BuiltinModule from CompilerModuleoverride() instead of install() for CompilerModule [#116]Full Changelog: 1.11.0...1.12.0
Note : The on-demand compiler will be deprecated.
The dependencies of nikic/PHP-Parser have been removed, and the entire system has been rewritten using a fast compiler based on the Visitor pattern.
The on-demand compilation has been removed, and a compile injector has been added that only uses simple, clean, compiled code.
Pre-compile your dependencies:
use Ray\Compiler\Compiler;
$compiler = new Compiler();
// Compile Ray.Di bindings to PHP files
$compiler->compile(
$module, // AbstractModule: Your application's module
$scriptDir // string: Directory path where compiled PHP files will be generated
);Use the compiled injector:
use Ray\Compiler\CompiledInjector;
$injector = new CompiledInjector($scriptDir);
$instance = $injector->getInstance(YourInterface::class);Note: The on-demand compiler will be deprecated.
Full Changelog: 1.10.6...1.11.0
Previous releases (prior to 1.11.0) are not documented in this changelog.
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 →