Inversion of Control: Integration into Stubbles MVC

Stubbles provides an class named net::stubbles::ioc::stubApp that you can use in your Stubbles MVC application, which will create a stubFrontController using given bindings.

stubApp::createFrontController(new stubPropertiesBindingModule($projectPath),
                               'net::stubbles::ipo::ioc::stubIpoBindingModule',
                               'net::stubbles::util::log::ioc::stubLogBindingModule',
                               'net::stubbles::util::cache::ioc::stubCacheBindingModule',
                               stubWebsiteBindingModule::createWithXmlProcessorAsDefault('interceptors')
                                                       ->enableRss('interceptors')
                                                       ->enableJsonRpc('interceptors')
         )
       ->process();

To add your own bindings you may implement the net::stubbles::ioc::module::stubBindingModule interface.

<?php
/**
 * Application specific bindings
 */
stubClassLoader::load('net::stubbles::ioc::module::stubBindingModule');
/**
 * Application specific bindings
 */
class MyBindingModule extends stubBindingModule
{
    /**
     * Configure the bindings
     *
     * @param  stubBinder    $binder    the binder to configure
     */
    public function configure(stubBinder $binder)
    {
        $binder->bind('Foo')->to('FooImpl');
        // more bindings should follow here
    }
}
?>