承接 infection/include-interceptor 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

infection/include-interceptor

最新稳定版本:0.2.5

Composer 安装命令:

composer require infection/include-interceptor

包简介

Stream Wrapper: Include Interceptor. Allows to replace included (autoloaded) file with another one.

README 文档

README

Build Status Coverage Status

Infection - Include Interceptor Stream Wrapper

It's a Stream Wrapper that wraps a file:// protocol and allows overriding content of any (auto) loaded file, including files autoloaded by Composer package manager.

Installation

composer require infection/include-interceptor

How it works

If you want to replace the content of the file whenever it's loaded (by executing include '/path/to/file.php, by calling file_get_contents('/path/to/file.php'), etc.), you need to register IncludeInterceptor before loading original file:

use Infection\StreamWrapper\IncludeInterceptor;

IncludeInterceptor::intercept('/path/to/original_file.php', '/path/to/replacement_file.php');
IncludeInterceptor::enable();

After enabling IncludeInterceptor, content of the replacement_file.php will be loaded instead of content of the original_file.php.

Use cases

  • This Stream Wrapper is used to replace the original file with the Mutant in Infection Mutation Testing Framework
  • The same approach is used in the dg/bypass-finals package that allows to mock final classes, by overriding original content and removing final keyword in runtime

Infection - Mutation Testing Framework

Please read documentation here: infection.github.io

Twitter: @infection_php

统计信息

  • 总下载量: 22.04M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 31
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 31
  • Watchers: 2
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04