CouchDb PHP Library
This library allows you to talk to a CouchDb server from within PHP. It saves you writing access functions to CouchDb's REST API. The primary goal of this library is ease of use. To achieve this, trade-offs had to be taken. They include speed optimiziation and cleaner code. A minor but also important goal was to allow this library to be used from PHP versions 4 to 6. Libraries with less code can be written for PHP 5 and 6 and they are planned already, but this is what is here now and it can be used by everyone.
A note on object oriented programming (OOP): This library makes use of PHP's OOP syntax but it does not neccessarily adhere to more advanced OOP design principles. The purpose of the two clases here is to encapsulate data and namespace functions. You can easily build a pure OOP Library on top of this library or from scratch.
The CouchDb PHP Library makes use of the PEAR package HTTP_Request which in turn uses the PEAR packge itself as well as Net_Socket and Net_URL.
To learn more about CouchDb, visit http://couchdb.com/
Usage Example:
<?php
include 'CouchDb/Couch.php';
$couch = new Couch('localhost', 'test');
if(!$couch->running()) {
die("The Couch is not running\n");
}
$doc = new CouchDocument;
$doc->set('Name', 'Micha');
$doc->set('Age', 24);
$doc->set('Cool', 'true');
$docid = $couch->save($doc);
echo "Successfully inserted $docid\n";
?>Enjoy!
Located in /Couch.php (line 87)
The host where CouchDb runs on
The IP port that CouchDb listenes on
Document Id of the document that holds the computed tables
Prefix for the fields of the document that holds the computed tables
Constructor
Set the CouchDb Library to be quiet about errors. Use in production.
Set the CouchDb Library to display error messages. Only useful and needed during development. Don't use in production!
Creates the CouchDb database
Determines if the CouchDb database exists
Deletes a CouchDocument
Determines if a CouchDocument with a given ID exists
Retrieves a single CouchDocument from the CouchDb database
Retrieves all documents from a table
Returns the lastest error message
Determines if CouchDb is running
Saves a CouchDocument
Set the CouchDb Library to display error messages. Only useful and needed during development. Don't use in production!
Set the CouchDb Library to be quiet about errors. Use in production.
Set the CouchDb Library to be quiet about errors. Use in production.
Set the CouchDb Library to display error messages. Only useful and needed during development. Don't use in production!
Adds a single or multiple computed tables to the CouchDb database
Deletes a table form CouchDb's $tables CouchDocument
Determines if a table already exists in the $tables CouchDocument
Updates a single or multiple table definitions
Documentation generated on Sun, 19 Nov 2006 13:28:39 +0100 by phpDocumentor 1.3.1