infection/include-interceptor
PHP stream wrapper that intercepts the file:// protocol to override the content of any included or autoloaded file at runtime. Register a mapping from original file to replacement, enable the interceptor, and includes/file_get_contents load the replacement instead.
Architecture fit: The package remains a niche tool for Laravel projects, primarily useful in test environments for mutation testing (e.g., Infection) or custom file inclusion instrumentation. The 1.0.0 release introduces no architectural changes, reinforcing its stability and limited scope. The stream wrapper’s role in monitoring include/require calls is still misaligned with Laravel’s production workflows but is now production-ready in terms of versioning (1.0.0). The lack of new features or breaking changes means the package continues to serve its original purpose without expanding its use cases.
Integration feasibility: High for test environments, with no new risks introduced by the 1.0.0 release. The stream wrapper’s reliability has been validated over time, and the lock constant fix from 0.2.5 remains critical for parallel test execution. Integration still requires careful sequencing (e.g., registration after Composer autoloading) and explicit opt-in via test bootstraps. Conflicts with Laravel’s core filesystem or caching remain unlikely but require validation in custom setups.
Technical risk:
Key questions:
Stack fit:
vendor/ or bootstrap/ paths outside test contexts.Migration path:
1.0.0 via Composer (composer require infection/include-interceptor:1.0.0).phpunit.xml or tests/bootstrap.php):
<php>
<includePath>./vendor/infection/include-interceptor/bootstrap.php</includePath>
</php>
Or in PHP:
require __DIR__ . '/vendor/infection/include-interceptor/bootstrap.php';
include/require in a dummy test class to confirm instrumentation works without autoloader conflicts.Compatibility:
Filesystem or Laravel’s Illuminate/Filesystem.Sequencing:
app()->environment('testing') or PHPUnit bootstrap files).Maintenance:
README or team wiki to reflect 1.0.0 stability and clarify its test-only use case.Support:
Scaling:
include), with no new dependencies or runtime costs.Failure modes:
| Scenario | Impact | Mitigation |
|---|---|---|
| Premature wrapper registration | Autoloader corruption | Use phpunit.xml or test bootstrap. |
| File locking deadlocks | Test hangs/corruption | Avoid in CI with high concurrency. |
| Infection/PHPUnit version skew | Undefined behavior | Pin versions in composer.json. |
Ramp-up:
composer.json and configure in phpunit.xml or bootstrap files; validate with a simple test case.How can I help you explore Laravel packages today?