PHP-on-Couchを利用して、Apache CouchDBにアクセス、ドキュメント更新です。ORMライクで、非常に楽。
参考サイト
PHPのApache CouchDBデータアクセスライブラリ「PHP-on-Couch」
use PHPOnCouch\CouchClient;
// 接続
$client = new CouchClient('http://admin:password@127.0.0.1:5984', 'customers');
// IDでドキュメントデータを取得
$doc = $client->getDoc('5945d346-f70e-46bb-886f-2dc88465dfe5');
$doc->firstname = "鈴木";
$doc->lastname = "一郎";
$doc->username = "suzukiichiro";
$doc->lastname = "suzukiichiro@example.com";
try {
$client->storeDoc($doc);
} catch (Exception $e) {
echo "Document storage failed : " . $e->getMessage() ;
}
参考サイト
PHPのApache CouchDBデータアクセスライブラリ「PHP-on-Couch」