bachi / couchdb
CouchDB Client for PHP >=5.5
Installs: 262
Dependents: 0
Suggesters: 0
Security: 0
Stars: 12
Watchers: 3
Forks: 3
Open Issues: 11
Requires
- php: >=5.5.0
- doctrine/common: ~2.3.0
- guzzlehttp/guzzle: ^6.0
This package is auto-updated.
Last update: 2024-10-12 03:46:59 UTC
README
A CouchDB Client for >=PHP 5.5 with event system.
Inspired by Doctrine/MongoDB and Doctrine/CouchDB
Installation
Composer
You can install CouchDB Client over composer. Add the following line into your composer.json
file.
$ composer require bachi/couchdb
Don't use composer?
Start to disover composer now! https://getcomposer.org
Usage
Initialize
$client = new \GuzzleHttp\Client(['base_uri' => 'http://localhost:5984', 'http_errors' => false]); $connection = new \CouchDB\Connection($client);
Creates a database
$database = $conn->createDatabase('foobar'); // or with magic method $database = $conn->foobar;
Get a database instance
$database = $conn->selectDatabase('foobar'); // or with magic method $database = $conn->foobar;
Delete a database
if (true === $conn->hasDatabase('foobar')) { $conn->dropDatabase('foobar'); } // or with magic methods if (isset($conn->foobar)){ unset($conn->foobar); }
Unit Tests (PHPUnit)
The testsuite can you find in the tests
folder.
Run the testsuite:
phpunit
It is green?
Credits
- Markus Bachmann markus.bachmann@bachi.biz
- [All contributors] (https://github.com/Baachi/CouchDB/contributors)
License
CouchDB Client is released under the MIT License. See the bundled LICENSE file for details.