Skip to content

Add Japanese technical comparison with other PHP DI containers#334

Draft
koriym wants to merge 2 commits into
2.xfrom
claude/di-framework-comparison-doc-g30r1r
Draft

Add Japanese technical comparison with other PHP DI containers#334
koriym wants to merge 2 commits into
2.xfrom
claude/di-framework-comparison-doc-g30r1r

Conversation

@koriym

@koriym koriym commented Jul 18, 2026

Copy link
Copy Markdown
Member

概要

PHP の他の DI コンテナ (PHP-DI / Symfony DependencyInjection / Laravel コンテナ) と Ray.Di の技術的な違いを解説する日本語ドキュメント docs/comparison.ja.md を追加し、README からリンクしました。

対象読者は DI の基本概念を理解している層です。技術的な比較のみを扱い、人気やコミュニティ規模はスコープ外です。全体を「コンテナはサービスレジストリではなく、型からオブジェクトグラフを構築する injector である」というテーゼで貫き、機能の羅列ではなく設計判断とトレードオフとして記述しています。

構成

  1. 束縛のキー — 型と修飾子
  2. 設定の表現 — 型付き PHP コード (3コンテナとの並列対比はこの節のみ)
  3. 設定の合成 — モジュールと、契約テストで仕様化された優先順位 (tests/di/README.md 準拠)
  4. AOP — 束縛と同じモジュールで宣言する横断的関心事
  5. スコープ — Prototype 既定
  6. 実行戦略 — ランタイム / Injector 直列化 / ray/compiler
  7. 注入の語彙 — InjectionPoint・context 付き Provider・toConstructor・Map
  8. 診断とテスト — Unbound チェーン・override()・toNull()・Bindings スナップショット
  9. トレードオフ — Ray.Di が選ばなかったもの (コンパイル時検証・設定の非コード表現・lazy proxy 等)
  10. まとめ

検証

  • Ray.Di 側のスニペットはすべて demo/tests/src/ の実在コードに基づき、API (Bind DSL / Matcher::any・annotatedWith / MethodInvocation / Scope 既定値 / Unbound 書式など) をソースと突合しました
  • 他コンテナ側の記述 (PHP-DI 6+ のスコープ廃止、Symfony の shared 既定とコンパイル、Laravel の bind()/scoped() など) は各公式ドキュメントで確認しました (2026-07 時点)
  • php demo/run.php を実行し demo 01〜10 の動作を確認。§8 の Unbound 出力は実際の実行出力を転載しています

備考 (このPRのスコープ外の発見)

demo/12-dependency-chain-error-message.php は、コメントと検証文字列が旧メッセージ形式 (dependency 'X' with name '' used in...) のままのため、現行の出力形式 ('X-' in file.php:7 ($param)) に対して "It DOES NOT work!" と表示されます。デモ自体の更新は本PRには含めていません。

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q7oj86ydbhXQotYy6BAEcu

Explain the design decisions that distinguish Ray.Di from PHP-DI,
Symfony DI, and the Laravel container: type + qualifier binding keys,
the type-checked binding DSL, contract-tested module composition
precedence, integrated AOP, prototype-default scope, execution
strategies, injection-context vocabulary, and diagnostics — with the
trade-offs of each decision stated. Link the doc from README.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7oj86ydbhXQotYy6BAEcu
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2d81c9e) to head (3b7a43c).

Additional details and impacted files
@@             Coverage Diff             @@
##                 2.x      #334   +/-   ##
===========================================
  Coverage     100.00%   100.00%           
  Complexity       460       460           
===========================================
  Files             53        53           
  Lines           1184      1184           
===========================================
  Hits            1184      1184           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 02c84ec3-e159-4f28-b0a7-bdf1f311dde7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/di-framework-comparison-doc-g30r1r

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Lead the binding-key section with the type + qualifier key design
instead of arguing against PSR-11, and drop the dedicated PSR-11
trade-off paragraph in favor of a one-line adapter note. PSR-11 now
appears only as a fact about the compared containers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Q7oj86ydbhXQotYy6BAEcu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants