Fjor, dependency injection container
Posted: Fri Jun 01, 2012 4:18 pm
I've extracted a dependency injection container from another project and adapted it somewhat so that it could be useful to more people. I don't know if i succeeded so I'm hoping to get some feedback, especially if usage makes sense.
Documentation is here:
https://github.com/koenhoeymans/Fjor/bl ... /index.txt
Or, maybe easier, the end-to-end tests:
https://github.com/koenhoeymans/Fjor/bl ... ocTest.php
An example from these tests. Suppose you have a class that asks for an object implementing ArrayAccess, you can tell Fjor to use an instance of SplObjectStorage, and use the same instance every time it is needed:
I think the code makes it clear what it is all about but since I'm not natively english I may be wrong here.
Documentation is here:
https://github.com/koenhoeymans/Fjor/bl ... /index.txt
Or, maybe easier, the end-to-end tests:
https://github.com/koenhoeymans/Fjor/bl ... ocTest.php
An example from these tests. Suppose you have a class that asks for an object implementing ArrayAccess, you can tell Fjor to use an instance of SplObjectStorage, and use the same instance every time it is needed:
Code: Select all
$fjor->given('ArrayAccess')->thenUse('SplObjectStorage')->inSingletonScope();