ray / di
Guice style dependency injection framework
Requires
- php: ^8.2
- koriym/null-object: ^1.0
- ray/aop: ^2.19
Requires (Dev)
- ext-pdo: *
- bamarni/composer-bin-plugin: ^1.4
- phpunit/phpunit: ^11.0
Suggests
- ray/compiler: For compiling dependency injection container to improve performance
This package is auto-updated.
Last update: 2026-07-16 14:08:32 UTC
README
A dependency injection framework for PHP
Ray.Di is DI and AOP framework for PHP inspired by Google Guice.
Binding snapshots
Collect a module's composed bindings explicitly when diagnostics are needed:
use Ray\Bindings\Bindings; $bindings = new Bindings(); $module->accept($bindings); $markdown = $bindings->toMarkdown(); $html = $bindings->toHtml($composerLock, 'prod-app', $vendorDir);
The snapshot is captured when accept() is called. Later module changes and
Injector processing do not change it; visiting another module with the same
Bindings instance replaces the snapshot. It contains bindings composed by
the application module through bind(), install(), and override(), without
Injector built-ins or bindings discovered later during object resolution.
Injector does not create bindings.md automatically. Applications that
previously read that generated file should use toMarkdown() or toHtml() as
shown above. The explicit Ray\Bindings\BindingsMarkdown file writer and the
bindings-html command remain available for file-based workflows.