Last active
December 15, 2015 08:29
-
-
Save cameronjacobson/5230875 to your computer and use it in GitHub Desktop.
Intuitive way to interact with CouchDB documents
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Phreezer project page: | |
* https://github.com/cameronjacobson/Phreezer | |
*/ | |
class Vehicle | |
{ | |
public function __construct(){} | |
} | |
require_once('vendor/autoload.php'); | |
use Phreezer\Storage\CouchDB; | |
$couch = new CouchDB([ | |
'database' => 'mydb' | |
]); | |
// create vehicle object and store it in CouchDB | |
$vehicle = new Vehicle(); | |
$vehicle->make = 'Ford'; | |
$vehicle->model = 'Mustang'; | |
$uuid = $couch->store($vehicle); | |
// retrieve vehicle object from CouchDB | |
$vehicle = $couch->fetch($uuid); | |
var_dump($vehicle); | |
// delete vehicle object | |
$vehicle->_delete = true; | |
$couch->store($vehicle); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment