ibm-watson-data-lab/php-couchdb
Composer 安装命令:
composer require ibm-watson-data-lab/php-couchdb
包简介
Library for easily talking to CouchDB from PHP
README 文档
README
PHP CouchDB
⚠️ This project is under early and active development. Comments, experimentation and feedback all gratefully received.
A lightweight library to make it very easy to work with CouchDB from PHP. Uses Guzzle, requires PHP 7+.
Installation
It's recommended to install this library using Composer:
composer require ibm-watson-data-lab/php-couchdb
Usage
Here's the tl;dr of how to begin. For more detailed examples, see the wiki and/or generate the API docs with composer docs
<?php require "vendor/autoload.php"; // connect to CouchDB (does make a call to check we can connect) $server = new \PHPCouchDB\Server(["url" => "http://localhost:5984"]); // get a list of databases; each one is a \PHPCouchDB\Database object $databases = $server->getAllDbs(); // work with the "test" database (also a \PHPCouchDB\Database object) $test_db = $server->useDb(["name" => "test", "create_if_not_exists" => true]); // add a document - you may specify the "id" here if you like $doc = $test_db->create(["name" => "Alice", "interests" => ["eating", "wondering"]]); // inspect the document print_r($doc); // update the document - a NEW document is returned by this operation, showing the server representation of the document $doc->friends[] = "Cheshire Cat"; $updated_doc = $doc->update(); // done? Delete the doc $updated_doc->delete();
For more examples, conflict handling and really everything else, see more detailed documentation on the wiki.
For Developers
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.
For information about working with the project locally or opening pull requests, see [[CONTRIBUTING]].
统计信息
- 总下载量: 1.19k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-07-27