dm/runtime

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.

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

1.0.0 2013-11-07 19:47 UTC

This package is not auto-updated.

Last update: 2020-01-20 03:27:10 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();