Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Deliciously Simple PHP Interface to CouchDB REST API (Inspired by CouchRest for Ruby and couchdb-python libraries). Main design principle of Settee is to be easy and fun to use and not get in your way.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 src
Octocat-spinner-32 tests
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 LICENSE.txt
Octocat-spinner-32 README.textile

Inspired by: CouchRest library for Ruby and the couchdb-python library.

Server Functions

  1. Specify a server:
    $server = new SetteeServer('');
  2. Database API
    1. Create a database:
      $ret = $server->create_db('irakli_test');
    2. Drop a database:
      $ret = $server->drop_db('irakli_test');
    3. List all databases:
      $ret = $server->list_dbs();
    4. Get a database object
      $db = $server->get_db('irakli_test');
  3. Document API
    1. Create/Update a document:
      $ret = $db->save($doc);
    2. Retrieve a document:
      $db_doc = $db->get($id);
    3. Determine the latest revision_id for a document:
      $rev = $db->get_rev($id);
    4. Delete a document:
      $db_doc = $db->delete($doc);
  4. Attachments API
    1. Add content as attachment:
      $db->add_attachment($doc, "foo.txt", "Some text that will be base64 encoded", "text/plain");
    2. Add a file path to be attached:
      $db->add_attachment_file($doc, "foo.pdf", $file_path, "application/pdf");
    3. Add a file path to be attached (mime-type is auto-detected):
      $db->add_attachment_file($doc, "foo.pdf", $file_path);
    4. Full attachment saving example:
      $doc = new stdClass();
      $doc→id = “attachment_doc”;
      $file_path = dirname(
      _FILE__) . “/resources/couch-logo.pdf”;
      $this→db→add_attachment_file($doc, “foo.pdf”, $file_path, “application/pdf”);
      $db_doc = $this→db→save($doc);
    5. ATTENTION: there is no “load_attachments” method, because when you load a document, all its attachments get loaded with it, as well.
  5. Views API
    1. Create a new view or save a view:
      $view = $db->save_view("some_design_document_id", "a_view_name", $map_src);
      $view = $db->save_view("some_design_document_id", "a_view_name", $map_src, $reduce_src);
    2. Get a view (run query and get results):
      $view = $db->get_view("some_design_document_id", "a_view_name");
    3. Parametrized view:
      $view = $db->get_view("some_design_document_id", "a_view_name", "2009/02/17 21:13:39");
    4. Parametrized view with key range:
      $view = $db->get_view("some_design_document_id", "a_view_name", array("2009/01/30 18:04:11", "2009/02/17 21:13:39"));
    5. Parametrized view with key range, ordered descending:
      $view = $db->get_view("some_design_document_id", "a_view_name", array("2009/01/30 18:04:11", "2009/02/17 21:13:39"), true);


  1. PHP 5.2 or newer


  1. PHP 5.3 or newer. With PHP 5.2 following functionality will not work:
    1. Some unit-tests
    2. Mime type auto-detection.
  2. pecl_http
Something went wrong with that request. Please try again.