https://github.com/baachi/couchdb
CouchDB Client for PHP >=5.5
https://github.com/baachi/couchdb
couchdb-client php
Last synced: about 1 year ago
JSON representation
CouchDB Client for PHP >=5.5
- Host: GitHub
- URL: https://github.com/baachi/couchdb
- Owner: Baachi
- License: mit
- Created: 2011-12-24T23:18:03.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2018-04-16T06:25:16.000Z (about 8 years ago)
- Last Synced: 2024-10-12T04:35:06.603Z (over 1 year ago)
- Topics: couchdb-client, php
- Language: PHP
- Homepage:
- Size: 163 KB
- Stars: 12
- Watchers: 3
- Forks: 3
- Open Issues: 11
-
Metadata Files:
- Readme: Readme.md
- Changelog: Changelog.md
Awesome Lists containing this project
README
# CouchDB #
A CouchDB Client for >=PHP 5.5 with event system.
Inspired by [Doctrine/MongoDB](https://github.com/Doctrine/mongodb) and [Doctrine/CouchDB](https://github.com/Doctrine/couchdb-odm)
| Service | Status |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Travis CI | [](http://travis-ci.org/Baachi/CouchDB) |
| Scrutinizer | [](https://scrutinizer-ci.com/g/Baachi/CouchDB/) |
| Code Coverage | [](https://scrutinizer-ci.com/g/Baachi/CouchDB/) |
| SensioLabsInsight | [](https://insight.sensiolabs.com/projects/9a96763c-c938-48a6-a9fa-ac77efb7197d) |
| Style CI | [](https://styleci.io/repos/3046372) |
## 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 ###
```php
$client = new \GuzzleHttp\Client(['base_uri' => 'http://localhost:5984', 'http_errors' => false]);
$connection = new \CouchDB\Connection($client);
```
### Creates a database ###
```php
$database = $conn->createDatabase('foobar');
// or with magic method
$database = $conn->foobar;
```
### Get a database instance ###
```php
$database = $conn->selectDatabase('foobar');
// or with magic method
$database = $conn->foobar;
```
### Delete a database ###
```php
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
* [All contributors] (https://github.com/Baachi/CouchDB/contributors)
## License ##
CouchDB Client is released under the MIT License. See the bundled LICENSE file for details.