Skip to content

Instantly share code, notes, and snippets.

@Ocramius
Created February 22, 2012 22:25
Show Gist options
  • Save Ocramius/1887966 to your computer and use it in GitHub Desktop.
Save Ocramius/1887966 to your computer and use it in GitHub Desktop.
Zend\Di For MWop
<?php
namespace MWOP {
class Foo
{
public $bar;
public function setBar($bar)
{
$this->bar = $bar;
}
}
interface BarInterface
{
}
class Bar implements BarInterface
{
}
}
namespace {
include 'Zend_Di-2.0.0beta2.phar';
//include 'zf2bootstrap.php';
$di = new Zend\Di\Di;
$config = array(
'instance' => array(
'MWOP\Foo' => array(
'parameters' => array(
'bar' => 'MWOP\BarInterface'
)
)
)
);
$di->configure(new Zend\Di\Configuration($config));
$foo = $di->get('MWOP\Foo');
var_dump($foo);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment