Skip to content

Commit a4472e1

Browse files
committed
Add a readme with basic instructions
1 parent 5cff084 commit a4472e1

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# PHP CouchDB
2+
3+
:warning: This project is under early and active development. Comments, experimentation and feedback all gratefully received.
4+
5+
A lightweight library to make it very easy to work with [CouchDB](http://couchdb.apache.org/) from PHP. Uses [Guzzle](http://docs.guzzlephp.org/en/stable/), requires PHP 7+.
6+
7+
## Installation
8+
9+
It's recommended to install this library using [Composer](https://getcomposer.org/):
10+
11+
```
12+
composer require ibm-watson-data-lab/php-couchdb:dev-master
13+
```
14+
15+
## Usage
16+
17+
A simple use case to check you can connect to CouchDB and check what version of CouchDB it's running.
18+
19+
```php
20+
<?php
21+
22+
require "vendor/autoload.php";
23+
24+
$server = new \PHPCouchDB\Server(["url" => "http://localhost:5984"]);
25+
echo $server->getVersion();
26+
```
27+
28+
If you need any additional configuration of the HTTP connection, then you can supply a `"client"` element to the constructor's array argument, and pass any `\GuzzleHttp\ClientInterface` object to that. Check the [documentation of Guzzle Request Options](http://docs.guzzlephp.org/en/stable/request-options.html) as all of these can also be passed in the constructor of the `\GuzzleHttp\Client`.
29+
30+
```php
31+
<?php
32+
33+
require "vendor/autoload.php";
34+
35+
$client = new \GuzzleHttp\Client([
36+
"base_uri" => "http://localhost:5984"
37+
// set any other options here
38+
]);
39+
40+
$server = new \PHPCouchDB\Server(["client" => $client]);
41+
echo $server->getVersion();
42+
```
43+
44+
## For Developers
45+
46+
Contributions and issues are all _very_ welcome on this project - and of course we'd love to hear how you're using the library in your own projects.
47+
48+
Before offering pull requests, check that you can run the tests, generate the documentation, and that the syntax checks pass (instructions for all of these below ...) as Travis will run these on your patch. Pull requests will _require_ tests and documentation before they get merged, but feel free to open a pull request and ask for help.
49+
50+
### Running Tests
51+
52+
This project has [PHPUnit](https://phpunit.de/) tests. To run them: `composer test`
53+
54+
### Generating Documentation
55+
56+
This project uses [PHPDox](http://phpdox.de/) to generate API documentation. To generate the docs: `composer docs` and the output will be in the `docs/` directory.
57+
58+
### Syntax Checks
59+
60+
The syntax checker is [PHP Code Sniffer](https://github.com/squizlabs/PHP_CodeSniffer) adn you can run this with `composer phpcs`

0 commit comments

Comments
 (0)