Garden 0.5.0 review
Download
|
|
Garden is a dependency injection for PHP5.
Inspired by Spring Framework, it uses XML application context with syntax as similar as possible to Spring context definitions.
Kickstarter
Create example.xml file like this (don't forget to put garden-beans.dtd next to it!):
< ?xml version="1.0" encoding="UTF-8"? >
< !DOCTYPE beans PUBLIC "-//GARDEN//DTD BEAN//EN" "garden-beans.dtd" >
< beans default-lazy-init="true" >
< bean id="dog" class="Dog" file="ext/Dog.php" >
< property name="collar" >
< ref local="dogCollar"/ >
< /property >
< /bean >
< bean id="dogCollar" class="Collar" file="ext/Dog/Collar.php" >
< property name="spiked" value="true"/ >
< /bean >
< /beans >
etx/Dog.php contains:
class Dog
{
private $collar;
public function setCollar($collar)
{
$this->collar = $collar;
}
public function getCollar()
{
return $this->collar;
}
}
etx/Dog/Collar.php contains:
class Collar
{
private $spiked;
public function setSpiked($spiked)
{
$this->spiked = $spiked;
}
public function getSpiked()
{
return $this->spiked;
}
}
Garden 0.5.0 search tags