28
HeadCouch CouchDB PHP client

HeadCouch - CouchDB PHP Client

Embed Size (px)

DESCRIPTION

The HeadCouch API reference shows up how to store your data, access your documents and query your indexes in OOP manner inside your PHP projects.

Citation preview

Page 1: HeadCouch - CouchDB PHP Client

HeadCouchCouchDB PHP client

Page 2: HeadCouch - CouchDB PHP Client

Table of Content

1. Requirements2. Server3. Database4. Document5. Design Document6. Further reading

Page 3: HeadCouch - CouchDB PHP Client

1. Requirements

● PHP 5.x● cURL

Page 4: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->ping();?>

2.1. Accessing the root of a CouchDB instance

Page 5: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->uuid();?>

2.2. Requests a Universally Unique Identifier from the CouchDB instance

Page 6: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->allDbs();?>

2.3. Returns a list of all the databases

Page 7: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->activeTasks();?>

2.4. List of running tasks

Page 8: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->dbUpdates();?>

2.5. Returns a list of all database events in the CouchDB instance

Page 9: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->log();?>

2.6. Gets the CouchDB log

Page 10: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->restart();?>

2.7. Restarts the CouchDB instance

Page 11: HeadCouch - CouchDB PHP Client

2. Server

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchServer::newInstance()->stats();?>

2.8. Returns the statistics for the running server

Page 12: HeadCouch - CouchDB PHP Client

3. Database

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDatabase::newInstance('db_name')->create();?>

3.1. Create database

Page 13: HeadCouch - CouchDB PHP Client

3. Database

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDatabase::newInstance('db_name')->delete();?>

3.2. Delete database

Page 14: HeadCouch - CouchDB PHP Client

3. Database

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDatabase::newInstance('db_name')->get();?>

3.3. Gets information about the specified database

Page 15: HeadCouch - CouchDB PHP Client

3. Database

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDatabase::newInstance('db_name')->head();?>

3.4. Returns the HTTP Headers about the specified database

Page 16: HeadCouch - CouchDB PHP Client

3. Database

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDatabase::newInstance('db_name')->post(array( 'key1' => 'val1', 'key2' => 'val2'));?>

3.5. Creates a new document in the specified database

Page 17: HeadCouch - CouchDB PHP Client

4. Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDocument::newInstance('db_name', 'doc_name')->create(array( 'key1' => 'val1', 'key2' => 'val2'));?>

4.1. Creates a new document

Page 18: HeadCouch - CouchDB PHP Client

4. Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDocument::newInstance('db_name', 'doc_name')->delete();?>

4.2. Deletes the specified document from the database

Page 19: HeadCouch - CouchDB PHP Client

4. Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDocument::newInstance('db_name', 'doc_name')->get();?>

4.3. Returns document

Page 20: HeadCouch - CouchDB PHP Client

4. Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDocument::newInstance('db_name', 'doc_name')->getRevision();?>

4.4. Returns document's revision token

Page 21: HeadCouch - CouchDB PHP Client

4. Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDocument::newInstance('db_name', 'doc_name')->head();?>

4.5. Returns the HTTP Headers about the specified document

Page 22: HeadCouch - CouchDB PHP Client

5. Design Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDdoc::newInstance('db_name', 'doc_name')->head();?>

5.1. Returns the HTTP Headers about the specified design document

Page 23: HeadCouch - CouchDB PHP Client

5. Design Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDdoc::newInstance('db_name', 'doc_name')->get();?>

5.2. Returns design document

Page 24: HeadCouch - CouchDB PHP Client

5. Design Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDdoc::newInstance('db_name', 'doc_name')->put();?>

5.3. Creates a new design document

Page 25: HeadCouch - CouchDB PHP Client

5. Design Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDdoc::newInstance('db_name', 'doc_name')->delete();?>

5.4. Deletes the specified document from the database

Page 26: HeadCouch - CouchDB PHP Client

5. Design Document

<?phprequire_once 'HeadCouch.php';

$result = HeadCouchDdoc::newInstance('db_name', 'doc_name')->getRevision();?>

5.5. Returns document's revision token

Page 28: HeadCouch - CouchDB PHP Client

https://twitter.com/DimitarIvanov

Dimitar Ivanov