PackageTrack
Sign in Get early access

ray/compiler

A dependency injection compiler for Ray.Di

1.16.0 2.0M downloads/mo #2861 most downloaded on Packagist ray-di/Ray.Compiler

What this package is like to depend on

Last release 9 days 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

9 releases in the last 12 months

see the full history below

Release timeline

59 releases · Apr 2015 to Aug 2026
2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026
Release Pre-release

Releases

latest 59
  1. 1.16.0 14 Aug 2026
    Release notes

    Added

    • Accept 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]
    Open source →
    Release notes

    Added

    • Accept 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]
    Open source →
  2. 1.15.0 08 Aug 2026
    Release notes

    1.15.0

    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 startup

    In 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]

    Compile-time rejection of injection-point singletons

    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.

    Other changes

    • Reject an unsafe dependency index instead of encoding it; escape the index and export serialized values in generated code [#139]
    • Generated scripts no longer carry // prototype / // singleton scope comments [#140]
    • Fix the singleton PostConstruct lifecycle: the injector caches itself, and a failed setter/setContext() rolls back the provisional cache entry instead of leaving a half-initialized singleton [#138]

    Upgrade notes

    • If your module binds an injection-point-dependent provider as a singleton, compile() now fails — change the binding to prototype scope.
    • Recompile your scripts with 1.15.0 before calling warmup(); it throws SingletonsFileNotFound when singletons.json is missing.
    Open source →
    Release notes

    Added

    • Add 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]
    • Add SingletonRequiresInjectionPoint exception — compile() rejects singletons whose construction needs a caller-supplied injection point (first-consumer-wins bindings); use prototype scope instead [#140]
    • Add InjectionPointNotAvailable exception — resolving an injection-point binding without a consumer context fails with a dedicated exception instead of a bare TypeError [#140]
    • Add SingletonsFileNotFound exception — warmup() fails loudly when the singleton metadata is missing (recompile) [#140]

    Changed

    • Reject an unsafe dependency index instead of encoding it; escape the index and export serialized values in generated code [#139]
    • Generated scripts no longer carry // prototype / // singleton scope comments; the $singletons write line already expresses the scope [#140]

    Fixed

    • Align the singleton PostConstruct lifecycle with Ray.Di: the injector caches itself, and a failed setter/setContext() rolls back the provisional cache entry instead of leaving a half-initialized singleton behind [#138]
    Open source →
  3. 1.14.0 12 Jul 2026
    Release notes

    Changed

    • Skip 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]
    • Deprecate ScriptFileNotFound exception (kept for BC) [#134]
    • Remove redundant realpath() call in CompiledInjector::getInstance() [#134]
    • Resolve #[ScriptDir] to __DIR__ instead of baking the compile-time absolute path [#136]

    Added

    • Add performance documentation (docs/performance.md) covering OPcache prerequisites and benchmarking methodology [#134]
    • Add self-validating DI benchmark under demo/benchmark/ [#134]

    Fixed

    • Add --memory-limit=256M to phpstan in composer scripts
    Open source →
    Release notes

    Changed

    • Skip 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]
    • Deprecate ScriptFileNotFound exception (kept for BC) [#134]
    • Remove redundant realpath() call in CompiledInjector::getInstance() [#134]
    • Resolve #[ScriptDir] to __DIR__ instead of baking the compile-time absolute path [#136]

    Added

    • Add performance documentation (docs/performance.md) covering OPcache prerequisites and benchmarking methodology [#134]
    • Add self-validating DI benchmark under demo/benchmark/ [#134]

    Fixed

    • Add --memory-limit=256M to phpstan in composer scripts
    Open source →
  4. 1.13.1 04 Dec 2025
    Release notes

    Fixed

    • Fix typo in variable and directory name in DependencySaver (qualiferqualifier) #131

    Thanks

    Open source →
    Release notes

    Fixed

    • Fix typo in variable and directory name in DependencySaver (qualiferqualifier) [#131]
    Open source →
  5. 1.13.0 18 Nov 2025
    Release notes

    Changed

    • Require PHP 8.2+ (drop PHP 7.x support) [#129]
    • Remove deprecated Doctrine annotations

    Added

    • Add demo for Ray.Compiler usage [#130]

    Removed

    • Remove unused exception classes
    Open source →
    Release notes

    Changed

    • Require PHP 8.2+ (drop PHP 7.x support) [#129]
    • Remove deprecated Doctrine annotations

    Added

    • Add demo for Ray.Compiler usage [#130]

    Removed

    • Remove unused exception classes
    Open source →
  6. 1.12.3 13 Nov 2025
    Release notes

    Fixed

    • Additional array type handling improvements (#128)

    New Contributors

    Full Changelog: 1.12.2...1.12.3

    Open source →
    Release notes

    Fixed

    • Additional array type handling improvements [#128]
    • Add missing EOL at end of test files
    Open source →
  7. 1.12.2 12 Nov 2025
    Release notes

    Fixed

    • Fix array handling in CompileVisitor to serialize arrays instead of using var_export() [#125]
    • Fix fatal error when arrays contain objects (e.g., [new Object(), 'method'])

    Full Changelog: 1.12.1...1.12.2

    Open source →
    Release notes

    Fixed

    • Fix array handling in CompileVisitor to serialize arrays instead of using var_export() [#125]
    • Fix fatal error when arrays contain objects (e.g., [new Object(), 'method'])
    Open source →
  8. 1.12.1 27 Oct 2025
    Release notes

    Fixed

    • Remove incorrect @deprecated annotation from DiCompileModule

    Links

    Open source →
    Release notes

    Fixed

    • Remove incorrect @deprecated annotation from DiCompileModule
    Open source →
  9. 1.12.0 25 Oct 2025
    Release notes

    Changed

    • Use override() in Compiler and remove BuiltinModule from CompilerModule
    • Use override() instead of install() for CompilerModule [#116]
    • Move Code4Dependency to src-deprecated and exclude from Psalm

    Added

    • Introduce Code4Dependency class and incorporate into DependencyCode
    • Add Symfony PHP 8.3 polyfill and Override attributes
    • Add PHP 8.5 support to CI
    • Add LLM documentation for Ray.Compiler [#118]

    Fixed

    • Remove duplicated class [#116]
    • Fix PHP 7.2 compatibility in CompilerModuleOverrideTest
    • Use domain types from Types.php and fix PHPStan type errors

    Full Changelog: 1.11.0...1.12.0

    Open source →
    Release notes

    Changed

    • Use override() in Compiler and remove BuiltinModule from CompilerModule
    • Use override() instead of install() for CompilerModule [#116]
    • Move Code4Dependency to src-deprecated and exclude from Psalm

    Added

    • Introduce Code4Dependency class and incorporate into DependencyCode
    • Add Symfony PHP 8.3 polyfill and Override attributes
    • Add PHP 8.5 support to CI
    • Add LLM documentation for Ray.Compiler [#118]

    Fixed

    • Remove duplicated class [#116]
    • Fix PHP 7.2 compatibility in CompilerModuleOverrideTest
    • Use domain types from Types.php and fix PHPStan type errors
    Open source →
  10. 1.11.0 04 Feb 2025
    Release notes

    What's Changed

    • Update PHP versions in CI workflow and update QA tools latest by @koriym in #114
    • CompileVisitor using the visitor pattern and CompiledInjector by @koriym in #115

    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.

    Basic Usage

    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

    Open source →
    Release notes

    Previous releases (prior to 1.11.0) are not documented in this changelog.

    Open source →
  11. 1.10.6 21 Oct 2024

    Nothing published for this version

  12. 1.10.5 10 May 2024

    Nothing published for this version

  13. 1.10.4 05 Mar 2024

    Nothing published for this version

  14. 1.10.3 21 Sep 2023

    Nothing published for this version

  15. 1.10.2 22 Aug 2023

    Nothing published for this version

  16. 1.10.1 24 Mar 2023

    Nothing published for this version

  17. 1.10.0 17 Mar 2023

    Nothing published for this version

  18. 1.9.2 31 Jan 2023

    Nothing published for this version

  19. 1.9.1 10 Jun 2022

    Nothing published for this version

  20. 1.9.0 03 Jun 2022

    Nothing published for this version

  21. 1.8.0 22 May 2022

    Nothing published for this version

  22. 1.7.0 23 Mar 2022

    Nothing published for this version

  23. 1.6.0 19 Mar 2022

    Nothing published for this version

  24. 1.5.1 23 Jun 2020

    Nothing published for this version

  25. 1.5.0 14 Jun 2020

    Nothing published for this version

  26. 1.4.1 06 Jun 2020

    Nothing published for this version

  27. 1.3.7 15 Jun 2019

    Nothing published for this version

  28. 1.3.6 18 May 2019

    Nothing published for this version

  29. 1.3.5 14 Jul 2018

    Nothing published for this version

  30. 1.3.4 14 Jul 2018

    Nothing published for this version

  31. 1.3.3 19 May 2018

    Nothing published for this version

  32. 1.3.2 15 May 2018

    Nothing published for this version

  33. 1.3.1 11 May 2018

    Nothing published for this version

  34. 1.3.0 07 May 2018

    Nothing published for this version

  35. 1.2.3 05 May 2018

    Nothing published for this version

  36. 1.2.2 04 May 2018

    Nothing published for this version

  37. 1.2.1 01 May 2018

    Nothing published for this version

  38. 1.2.0 30 Apr 2018

    Nothing published for this version

  39. 1.1.7 06 Mar 2018

    Nothing published for this version

  40. 1.1.5 27 May 2017

    Nothing published for this version

  41. 1.1.4 29 Apr 2017

    Nothing published for this version

  42. 1.1.3 28 Mar 2017

    Nothing published for this version

  43. 1.1.2 16 Mar 2017

    Nothing published for this version

  44. 1.1.1 16 Mar 2017

    Nothing published for this version

  45. 1.1.0 21 Feb 2017

    Nothing published for this version

  46. 1.0.5 16 Oct 2016

    Nothing published for this version

  47. 1.0.4 15 Sep 2016

    Nothing published for this version

  48. 1.0.3 29 Sep 2015

    Nothing published for this version

  49. 1.0.2 26 May 2015

    Nothing published for this version

  50. 1.0.1 22 May 2015

    Nothing published for this version

  51. 1.0.0 21 May 2015

    Nothing published for this version

  52. 0.3.0 14 May 2015

    Nothing published for this version

  53. 0.2.0 13 May 2015

    Nothing published for this version

  54. 0.1.5 12 May 2015

    Nothing published for this version

  55. 0.1.4 07 May 2015

    Nothing published for this version

  56. 0.1.3 03 May 2015

    Nothing published for this version

  57. 0.1.2 01 May 2015

    Nothing published for this version

  58. 0.1.1 30 Apr 2015

    Nothing published for this version

  59. 0.1.0 27 Apr 2015

    Nothing published for this version

Every package, every release, already written down.

The archive is open and free. Watching your own project is what we are building next.

Browse the archive