Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Include Interceptor Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

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:

  • Low for test environments: No changes to the core functionality or API; the package is stable and battle-tested.
  • Moderate for custom setups: Timing of stream wrapper registration is still critical, but the lack of updates reduces the risk of unforeseen interactions.
  • None for production: No impact on Laravel’s runtime or production workflows.

Key questions:

  1. Does the package’s stability (1.0.0) justify its adoption in CI/CD pipelines for mutation testing, or are there alternative tools (e.g., PHPStan extensions) with broader Laravel support?
  2. How does the package’s performance (e.g., overhead of stream wrapper) compare to native Laravel testing tools in high-concurrency environments?
  3. Are there Laravel-specific test runners (e.g., Laravel’s built-in test helpers) that could benefit from or conflict with this package’s instrumentation?

Integration Approach

Stack fit:

  • Test-focused: Ideal for Laravel projects using Infection or similar mutation testing tools. No changes to its non-production scope.
  • Non-production: Explicitly not designed for runtime Laravel applications; avoid in vendor/ or bootstrap/ paths outside test contexts.
  • Composer compatibility: Fully compatible; no breaking changes to autoloading or package dependencies.

Migration path:

  1. Update package: Replace existing version with 1.0.0 via Composer (composer require infection/include-interceptor:1.0.0).
  2. Re-register wrapper: Ensure the stream wrapper is initialized after Composer autoloading in test bootstraps (e.g., 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';
    
  3. Validate: Test with a sample include/require in a dummy test class to confirm instrumentation works without autoloader conflicts.

Compatibility:

  • Laravel 8+: No known conflicts with Symfony’s Filesystem or Laravel’s Illuminate/Filesystem.
  • PHP 8.0+: Continues to align with modern PHP’s file locking semantics.
  • Tooling: Explicitly tested with Infection; compatibility with other mutation testers (e.g., custom PHPStan rules) may require manual validation.

Sequencing:

  1. Critical order: Stream wrapper must register after Composer’s autoloader but before test execution.
  2. Avoid global scope: Restrict to test environments using environment checks (e.g., app()->environment('testing') or PHPUnit bootstrap files).

Operational Impact

Maintenance:

  • Low: No breaking changes or new features; update via Composer. Monitor for Infection or PHPUnit version skew in long-term usage.
  • Documentation: Update README or team wiki to reflect 1.0.0 stability and clarify its test-only use case.

Support:

  • Test environments: Primary use case; support limited to file inclusion monitoring scenarios.
  • Production: No support needed; package remains opt-in for tests only.

Scaling:

  • Parallel tests: No changes to performance or concurrency handling; lock constant fix continues to mitigate race conditions.
  • Resource usage: Stream wrapper overhead remains negligible (~1–2ms per 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:

  • For TPMs: No action required unless adopting mutation testing; evaluate as a stable test dependency.
  • For Devs: Add to composer.json and configure in phpunit.xml or bootstrap files; validate with a simple test case.
  • Training: Emphasize use case (e.g., "This package is for test instrumentation only; do not use in production."). Highlight 1.0.0 as a stable release with no new features.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui