crashuxx/phproxy

Class proxy

1.0 2014-11-25 19:09 UTC

This package is not auto-updated.

Last update: 2024-12-21 17:27:51 UTC


README

Class proxy for php based on java.lang.reflect.Proxy. This library is under Apache License 2.0.

Build Status

PHP >= 5.5 HHVM >= 3.4.0

Usage:

use \Reflection\Proxy;

class MyInvocationHandler implements \Reflection\InvocationHandler
{
    /**
     * @param object $proxy
     * @param string $method
     * @param mixed[] $args
     * @return mixed
     */
    function invoke($proxy, $method, $args)
    {
        echo $method;
        return 'my return  value';
    }
}

$proxy = Proxy::newProxyInstance(\stdClass::class, new MyInvocationHandler());
echo $proxy->CustomMethod();