2017 © Pedro Peláez
 

library interceptor

Intercept php includes

image

icewind/interceptor

Intercept php includes

  • Saturday, October 24, 2015
  • by icewind1991
  • Repository
  • 0 Watchers
  • 0 Stars
  • 46 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Interceptor

Build Status Code Coverage Scrutinizer Code Quality, (*1)

Intercept php includes, (*2)

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

The Versions

24/10 2015

dev-master

9999999-dev

Intercept php includes

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

24/10 2015

v0.3.0

0.3.0.0

Intercept php includes

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

17/10 2015

v0.2.0

0.2.0.0

Intercept php includes

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

26/09 2015

v0.1.0

0.1.0.0

Intercept php includes

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires