dm/runtime

PHP-library for disable and override standard functions in real-time

Installs: 2

Dependents: 0

Stars: 4

Watchers: 2

Open Issues: 1

Language: PHP

1.0.0 2013-11-07 19:47 UTC

README

Now, you can disable and override standard functions in real-time.

<?php
$code = <<<CODE
<?php
echo str_replace( 0, 1, 100 );
?>
CODE;

// thrown exception, becouse str_replace disabled
Dm\Runtime\Api::code($code)
    ->disableFunction('str_replace')
    ->execute();
<?php
$code = <<<CODE
<?php
echo str_replace( 0, 1, 100 );
?>
CODE;

// output 111
echo str_replace( 0, 1, 100 );

// output 000
Dm\Runtime\Api::code($code)
    ->overrideFunction('str_replace', function ($search, $replace, $subject) {
        echo str_replace($replace, $search, $subject);
    })
    ->execute();