PHP code example of schema31 / php-couchdb-watcher
1. Go to this page and download the library: Download schema31/php-couchdb-watcher library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
schema31 / php-couchdb-watcher example snippets
use Schema31\CouchDBWatcher\Watcher;
$options = [
'since' => 'now', // taken into account only if store is empty, default is '0'
'store' => new Schema31\CouchDBWatcher\Store\FileStore() // FileStore is the default one. You can provide your own object, that implements the StoreInterface
];
$watcher = new Watcher('main_db', 'https://couch.com/db', $options);
$watcher->addCallback(function($change) {
echo $change->id.PHP_EOL;
});
$watcher->run();