Skip to content

Instantly share code, notes, and snippets.

View jeremylivingston's full-sized avatar

Jeremy Livingston jeremylivingston

View GitHub Profile

Keybase proof

I hereby claim:

To claim this, I am signing this object:

@jeremylivingston
jeremylivingston / proxy.php
Created August 26, 2013 13:56
A basic example of how a core PHP class like SoapClient cannot be created as a proxy.
<?php
$config = new \ProxyManager\Configuration(); // customize this if needed for production
$factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory($config);
$proxy = $factory->createProxy(
'SoapClient',
function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {
$wrappedObject = new \SoapClient('http://www.blah.com'); // instantiation logic here
$initializer = null; // turning off further lazy initialization