PHPillow es una librería PHP que nos permite interactuar con CouchDB (base de datos documental de Apache basada en JSON).
Ahora que el NoSQL es una alternativa a las bases de datos relacionales, esta librería nos ayudará bastante a la hora de realizar nuestra aplicación, ya que el código es bastante sencillo.
class myBlogDocument extends phpillowDocument {
protected static $type = 'blog_entry';
protected $requiredProperties = array( 'title', 'text', );
public function __construct() {
$this->properties = array(
'title' => new phpillowStringValidator(),
'text' => new phpillowTextValidator(),
'comments' => new phpillowDocumentArrayValidator( 'myBlogComments' )
);
parent::__construct();
}
protected function generateId() {
return $this->stringToId( $this->storage->title );
}
protected function getType() {
return self::$type;
}
}