A CouchDB Client for >=PHP 5.3 with event system.
Inspired by Doctrine/MongoDB and Doctrine/CouchDB
GitHub:
You can clone the repository:
git clone --recursive https://github.com/Baachi/CouchDB.git
or if you already use git in your project
git submodule add https://github.com/Baachi/CouchDB.git
Composer:
You can install CouchDB Client over composer. Add the following line into your composer.json
file.
"requires": {
"couchdb/couchdb": "*"
}
And now, if you not use a autoloader, include the autoload.php.dist
in your project.
<?php
require_once '/path/to/couchdb/autoload.php.dist';
<?php
require_once '/path/to/couchdb/autoload.php.dist';
$client = new \CouchDB\Http\StreamClient('localhost', 5984);
$connection = new \CouchDB\Connection($client);
<?php
$database = $conn->createDatabase('foobar');
// or with magic method
$database = $conn->foobar;
<?php
$database = $conn->selectDatabase('foobar');
// or with magic method
$database = $conn->foobar;
<?php
if (true === $conn->hasDatabase('foobar') {
$conn->dropDatabase('foobar');
}
// or with magic methods
if ( isset($conn->foobar) ){
unset($conn->foobar);
}
The testsuite can you find in the tests
folder.
Run the testsuite:
phpunit
It is green?
- Markus Bachmann [email protected]
- [All contributors] (https://github.com/Baachi/Alien/contributors)
CouchDB Client is released under the MIT License. See the bundled LICENSE file for details.