PackageTrack
Sign in Get early access

ray/di

Guice style dependency injection framework

2.23.0 2.4M downloads/mo #2431 most downloaded on Packagist ray-di/Ray.Di

What this package is like to depend on

Last release 13 days ago

10 Aug 2026

Release timing varies

gaps range from 3 weeks to 12 months

Rarely documented

notes for 10 of 99 stable releases

Nothing withdrawn

no release was ever pulled

13 years old

102 releases · first in 2013

8 releases in the last 12 months

see the full history below

Release timeline

102 releases · Mar 2013 to Aug 2026
2014 2016 2018 2020 2022 2024 2026
Release Pre-release

Releases

latest 60 of 102
  1. 2.23.0 10 Aug 2026
    Release notes

    2.23.0

    Added

    • Write 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).
    • Add Ray\Di\ModuleVisitorInterface as the stable route for tools to visit a module's composed container via AbstractModule::accept() (#336).

    Removed

    • Move rich binding visualization out of core: 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).

    Fixed

    • Fix multibindings being lost from all but the first installed module (#340).
    • Distinguish an empty multibinding set from an undeclared one (#341).
    • Keep the first install's entry on a same-key multibinding collision (#348).
    • Exclude the MultiBindings index from the BindingLog (#347).
    • Roll back the singleton cache when @PostConstruct throws (#346).
    • Fix exception messages to follow the value-only convention (#339).

    Full Changelog: https://github.com/ray-di/Ray.Di/blob/2.x/CHANGELOG.md

    Open source →
    Release notes

    Added

    • Write 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).
    • Add Ray\Di\ModuleVisitorInterface as the stable route for tools to visit a module's composed container via AbstractModule::accept() (#336).

    Removed

    • Move rich binding visualization out of core: 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).

    Fixed

    • Fix multibindings being lost from all but the first installed module (#340).
    • Distinguish an empty multibinding set from an undeclared one (#341).
    • Keep the first install's entry on a same-key multibinding collision (#348).
    • Exclude the MultiBindings index from the BindingLog (#347).
    • Roll back the singleton cache when @PostConstruct throws (#346).
    • Fix exception messages to follow the value-only convention (#339).

    Included pull requests

    Open source →
  2. 2.22.2 19 Jul 2026
    Release notes

    Fixed

    • Non-instantiable concrete classes (e.g. private constructors) are no longer just-in-time bound. Requesting an unbound non-instantiable class fails with 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.

    Open source →
    Release notes

    Fixed

    • Reject non-instantiable classes (for example private constructors) from just-in-time binding. They now fail with Unbound instead of a bare PHP Error after language-level new in NewInstance (#335).
    Open source →
  3. 2.22.1 17 Jul 2026
    Release notes

    Added

    • Detect circular dependencies and report them with a dedicated exception, instead of recursing until the process dies (#319).
    • Add a binding provenance log recording how each binding was composed, and Ray\Bindings\Bindings snapshots for rendering it as Markdown or HTML — collected explicitly with $module->accept(new Bindings()) (#323, #331).
    • Add the Ray\Bindings\BindingsHtml viewer and the bin/bindings-html command (#325, #330).

    Changed

    • Improve module composition compatibility and DI hot-path performance (#316, #319, #333).
    • Update the CI and development toolchain for PHP 8.5, PHPUnit 11, PHP_CodeSniffer 4, and mutation testing (#315, #317, #326).

    Deprecated

    • Mark 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).

    Fixed

    • Preserve provider constructor injection points during dependency resolution (#320).
    • Correct JIT binding recursion, singleton handling, multi-binding scope clearing, and multi-interceptor registration (#318, #319).
    • Fix assisted injection re-entry with Ray.Aop 2.22's parent-call dispatch, and preserve explicit null arguments during assisted injection (#328).
    • Reject a rename onto an index that already has a binding instead of silently destroying it (#319).

    Included pull requests

    Open source →
    Release notes

    Added

    • Detect circular dependencies and report them with a dedicated exception, instead of recursing until the process dies (#319).
    • Add a binding provenance log recording how each binding was composed, and Ray\Bindings\Bindings snapshots for rendering it as Markdown or HTML — collected explicitly with $module->accept(new Bindings()) (#323, #331).
    • Add the Ray\Bindings\BindingsHtml viewer and the bin/bindings-html command (#325, #330).

    Changed

    • Improve module composition compatibility and DI hot-path performance (#316, #319, #333).
    • Update the CI and development toolchain for PHP 8.5, PHPUnit 11, PHP_CodeSniffer 4, and mutation testing (#315, #317, #326).

    Deprecated

    • Mark 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).

    Fixed

    • Preserve provider constructor injection points during dependency resolution (#320).
    • Correct JIT binding recursion, singleton handling, multi-binding scope clearing, and multi-interceptor registration (#318, #319).
    • Fix assisted injection re-entry with Ray.Aop 2.22's parent-call dispatch, and preserve explicit null arguments during assisted injection (#328).
    • Reject a rename onto an index that already has a binding instead of silently destroying it (#319).

    Included pull requests

    Open source →
  4. 2.20.0 24 Dec 2025
    Release notes

    What's Changed

    New Features

    • Add NoHint exception for parameters without type hints or binding names
    • Improve Unbound error messages with better formatting

    Developer Experience

    • Drop PHPUnit 8.x support (PHPUnit 9.5+ required)

    Full Changelog: 2.19.3...2.20.0

    Open source →
  5. 2.19.3 22 Nov 2025
    Release notes

    Changed

    • Enhanced BcParameterQualifier to support method-level Qualifier attributes on constructors
    Open source →
  6. 2.19.2 19 Nov 2025
    Release notes

    What's Changed

    Backward Compatibility Enhancement

    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

    • Automatically applies method-level InjectInterface+Qualifier attributes to parameters for single-parameter setters
    • Restores backward compatibility for code using combined attributes like #[FakeLogDbInject]
    • Only applies when attribute supports Attribute::TARGET_PARAMETER (distinguishes from Provider pattern)
    • Located in src-deprecated/di/ and marked as @deprecated

    Example (now works):

    #[FakeLogDbInject]  // InjectInterface + Qualifier
    public function setDb(ExtendedPdoInterface $pdo) { }

    Recommended Modern Approach:

    #[Inject]
    public function setDb(#[FakeLogDb] ExtendedPdoInterface $pdo) { }

    Naming Improvements:

    • Renamed: LegacyStringParserBcStringParser for consistency
    • All backward compatibility code now uses Bc prefix (Backward Compatibility)
    • Clearer, more concise naming throughout deprecated code

    Technical Details:

    • New class: Ray\Di\BcParameterQualifier with getNames() method
    • Renamed: Ray\Di\LegacyStringParserRay\Di\BcStringParser
    • Comprehensive test coverage for both BC features
    • Ray.Compiler compatible (inference happens at compile-time)

    This ensures compatibility with packages like Ray.AuraSqlModule that use method-level qualifier attributes.

    Full Changelog: 2.19.1...2.19.2

    Open source →
  7. 2.19.1 18 Nov 2025
    Release notes

    What's Changed

    Backward Compatibility Fix

    This release restores backward compatibility for the string format in toConstructor() method that was accidentally removed in 2.19.0 (commit da864a5).

    Restored Support:

    • String format: toConstructor(ClassName::class, 'param=name,param2=name2')
    • This format is now handled by the new LegacyStringParser class in src-deprecated/di/
    • Marked as @deprecated - prefer using parameter-level attributes or array format

    Recommended Modern Approaches:

    • Parameter-level attributes: #[Named('name')] on constructor parameters
    • Array format: toConstructor(ClassName::class, ['param' => 'name'])

    Technical Details:

    • New class: Ray\Di\LegacyStringParser for parsing legacy string format
    • Updated: Ray\Di\Name to delegate string parsing to LegacyStringParser
    • Added comprehensive tests for string format parsing

    This 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

    Open source →
  8. 2.19.0 17 Nov 2025
    Release notes

    Changed

    • 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

    Fixed

    • Remove unused AnnotationException references
    • Improve test coverage for optional setter injection

    Requirements

    • PHP 8.2+
    • ray/aop ^2.19
    Open source →
  9. 2.18.0 29 Nov 2024
    Release notes

    What's Changed

    • Bug fix: Handle missing dependencies in setter methods with #[Inject(optional: true)] by @koriym in #292
    • PHP 8.4 Support: Update CI to support PHP 8.4 and include PHP 8.3 in old_stable by @koriym in #293
    • Enhance code quality with Psalm annotations by @koriym in #294

    Full Changelog: 2.17.2...2.18.0

    Open source →
  10. 2.17.2 10 Sep 2024
    Release notes

    What's Changed

    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

    Open source →
  11. 2.17.1 27 May 2024

    Nothing published for this version

  12. 2.16.1 21 Sep 2023

    Nothing published for this version

  13. 2.16.0 15 Sep 2023

    Nothing published for this version

  14. 2.15.1 12 Jan 2023

    Nothing published for this version

  15. 2.15.0 06 Dec 2022

    Nothing published for this version

  16. 2.14.5 04 Jul 2022

    Nothing published for this version

  17. 2.14.1 23 Mar 2022

    Nothing published for this version

  18. 2.14.0 10 Mar 2022

    Nothing published for this version

  19. 2.13.3 08 Feb 2022

    Nothing published for this version

  20. 2.13.2 06 Nov 2021

    Nothing published for this version

  21. 2.13.1 05 Nov 2021

    Nothing published for this version

  22. 2.13.0 31 Oct 2021

    Nothing published for this version

  23. 2.12.2 09 Oct 2021

    Nothing published for this version

  24. 2.12.1 19 Aug 2021

    Nothing published for this version

  25. 2.12.0 20 Feb 2021

    Nothing published for this version

  26. 2.11.3 20 Jan 2021

    Nothing published for this version

  27. 2.11.2 17 Jan 2021

    Nothing published for this version

  28. 2.11.1 15 Jan 2021

    Nothing published for this version

  29. 2.11.0 13 Jan 2021

    Nothing published for this version

  30. 2.10.5 03 Oct 2020

    Nothing published for this version

  31. 2.10.4 30 Sep 2020

    Nothing published for this version

  32. 2.10.3 13 Jun 2020

    Nothing published for this version

  33. 2.10.2 04 Jun 2020

    Nothing published for this version

  34. 2.10.1 03 May 2020

    Nothing published for this version

  35. 2.10.0 03 Dec 2019

    Nothing published for this version

  36. 2.9.1 22 Nov 2019

    Nothing published for this version

  37. 2.9.0 28 Jul 2019

    Nothing published for this version

  38. 2.8.4 10 Jun 2019

    Nothing published for this version

  39. 2.8.3 05 Jun 2019

    Nothing published for this version

  40. 2.8.2 18 May 2019

    Nothing published for this version

  41. 2.8.1 30 Jan 2019

    Nothing published for this version

  42. 2.8.0 15 Jan 2019

    Nothing published for this version

  43. 2.7.2 21 Nov 2018

    Nothing published for this version

  44. 2.7.1 17 Jul 2018

    Nothing published for this version

  45. 2.7.0 08 May 2018

    Nothing published for this version

  46. 2.6.7 02 May 2018

    Nothing published for this version

  47. 2.6.6 21 Apr 2018

    Nothing published for this version

  48. 2.6.5 05 Mar 2018

    Nothing published for this version

  49. 2.6.4 02 Mar 2018

    Nothing published for this version

  50. 2.6.2 20 Aug 2017

    Nothing published for this version

  51. 2.6.1 20 Aug 2017

    Nothing published for this version

  52. 2.6.0 20 Aug 2017

    Nothing published for this version

  53. 2.5.3 22 Jul 2017

    Nothing published for this version

  54. 2.5.2 29 May 2017

    Nothing published for this version

  55. 2.5.1 28 Mar 2017

    Nothing published for this version

  56. 2.5.0 21 Feb 2017

    Nothing published for this version

  57. 2.4.1 01 Oct 2016

    Nothing published for this version

  58. 2.4.0 29 Sep 2016

    Nothing published for this version

  59. 2.3.2 17 May 2016

    Nothing published for this version

  60. 2.3.1 01 Mar 2016

    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