crashuxx / phproxy

1.0 2014-11-25 19:09 UTC

This package is not auto-updated.

Last update: 2024-09-28 16:31:06 UTC


README

基于java.lang.reflect.Proxy的PHP类代理。该库遵循Apache License 2.0

Build Status

PHP >= 5.5 HHVM >= 3.4.0

用法

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();