Use Respect\Config instead of php-di#1666
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1666 +/- ##
============================================
+ Coverage 99.53% 99.58% +0.04%
- Complexity 920 922 +2
============================================
Files 190 190
Lines 2147 2152 +5
============================================
+ Hits 2137 2143 +6
+ Misses 10 9 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Replaces the php-di implementation with Respect\Config, keeps PSR-11 compatibility. Respect\Config is much lighter (20Kb package, php-di is 80kb), and also much faster (80% gain on cold ValidatorBuild::init) than uncompiled php-di. While compiled php-di containers would be in theory even faster, it is awkward to commit their artifacts. Users that want ultimate performance can still leverage php-di with compilation by doing it (together with their app DI defs) and doing `setContainer` on our `ContainerRegistry`.
54d6001 to
4735dc8
Compare
|
I know this change would make some plans (autowiring sokil) harder. However, autowire is not PSR-11, and it would imply a soft dependency on php-di (or any other autowiring-enabled framework). Since version 6, php-di has been adding bloated features that dramatically reduce its runtime performance, and instead they've been focusing on compilation instead. While compilation is great (I used it in my swoole-microfw experiment), as a library it is awkward for us to deliver compiled containers. That kind of workflow works best when the user compiles the container for his/her own application instead (their stuff + our stuff all compiled together). Respect\Config is much leaner and has outstanding runtime performance, with still more gains to squeeze (it's basically a PHP 5.3 codebase ported to PHP 8.5 recently). My plan is to keep this as a draft until I launch Config 3.0. |
|
I will close and archive this experiment for further reference. |
Replaces the php-di implementation with Respect\Config, keeps PSR-11 compatibility.
Respect\Config is much lighter (20Kb package, php-di is 80kb), and also much faster (80% gain on cold ValidatorBuild::init) than uncompiled php-di.
While compiled php-di containers would be in theory even faster, it is awkward to commit their artifacts.
Users that want ultimate performance can still leverage php-di with compilation by doing it (together with their app DI defs) and doing
setContaineron ourContainerRegistry.Benchmarks: