icecave / traitor
Compose new classes using interfaces and traits at runtime.
Installs: 21
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 1
Open Issues: 1
pkg:composer/icecave/traitor
Requires
- php: >=5.4
Requires (Dev)
- icecave/archer: ~1
This package is not auto-updated.
Last update: 2020-01-20 03:53:11 UTC
README
Traitor is a PHP library for dynamically generating classes that implement certain interfaces by use of traits. The primary purpose is for creating test mocks.
- Install via Composer package icecave/traitor
- Read the API documentation
Example
The example below creates an instance of an object that implements the SomeInterface interface by using the SomeTrait
trait. It is passed the values 1, 2, and 3 as constructor parameters.
use Icecave\Traitor\Traitor; $instance = Traitor::create() ->implements_(SomeInterface::CLASS) ->use_(SomeTrait::CLASS) ->instance(1, 2, 3);
Contact us
- Follow @IcecaveStudios on Twitter
- Visit the Icecave Studios website
- Join
#icecaveon irc.freenode.net