定制 icewind/interceptor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

icewind/interceptor

最新稳定版本:v0.3.0

Composer 安装命令:

composer require icewind/interceptor

包简介

Intercept php includes

README 文档

README

Build Status Code Coverage Scrutinizer Code Quality

Intercept php includes

composer require icewind/interceptor

Usage

use Icewind\Interceptor\Interceptor;

$interceptor = new Interceptor();
$interceptor->addWhiteList(__DIR__ . '/src');
$interceptor->addHook(function($code) {
    return str_replace('foo', 'bar', $code);
});

$interceptor->setUp();

require 'src/foo.php'

API

  • addWhiteList(string $path): Add a folder to the white list
  • addBlackList(string $path): Add a folder to the black list
  • Only white listed files will be intercepted
  • A file is white listed if it has a parent folder that is white listed without there being a more direct parent folder that is black listed
  • addHook(callable $hook): Register a hook to the intercepter
  • the registered callback will be called for every include which is intercepted
  • The code being included will be passed as the first argument
  • The path being included will be passed as second argument
  • If the hook returns a string the loaded code will be replaced by the return value
  • setUp() start intercepting includes
  • tearDown() stop intercepting includes

统计信息

  • 总下载量: 134
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-09-26