Skip to content
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 

readme.md

Partial proxy class builder

Build Status SilverStripe supported module

Dynamically scaffold proxy classes that actually extend the class being proxied, allowing them to be used in type-strict applications.

No it's not prophecy because this is designed for partial proxies, not testing.

Examples

// Create a proxy creator
$proxy = ProxyFactory::create(DataBase::class)
    ->addMethod('connect', function ($args, $next) use ($logger) {
        $logger->log("Connecting to server " . $args[0]['server'];
        return $next(...$args);
    });
    
// Generate instance of our proxy
$instance = $proxy->instance();
assert($instance instanceof Database); // Yep!

// Connects to underlying database, logging the call
$instance->connect([
    'server' => 'localhost',
    'user' => 'root'
]);

About

Create partial proxies for classes

Topics

Resources

Packages

No packages published

Languages