{"id":19529149,"url":"https://github.com/riverside/headcouch","last_synced_at":"2025-09-02T17:09:10.745Z","repository":{"id":17067808,"uuid":"19832595","full_name":"riverside/HeadCouch","owner":"riverside","description":":dog: PHP client for Apache CouchDB","archived":false,"fork":false,"pushed_at":"2023-06-04T08:05:42.000Z","size":54,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-17T04:02:38.828Z","etag":null,"topics":["apache","apache-couchdb","client","couchdb","couchdb-client","library","nosql","php","php-client","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riverside.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/Dimitar81"}},"created_at":"2014-05-15T19:36:22.000Z","updated_at":"2024-05-17T04:02:38.829Z","dependencies_parsed_at":"2022-08-26T23:21:24.503Z","dependency_job_id":null,"html_url":"https://github.com/riverside/HeadCouch","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riverside%2FHeadCouch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riverside%2FHeadCouch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riverside%2FHeadCouch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riverside%2FHeadCouch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riverside","download_url":"https://codeload.github.com/riverside/HeadCouch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224033326,"owners_count":17244577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache","apache-couchdb","client","couchdb","couchdb-client","library","nosql","php","php-client","php-library"],"created_at":"2024-11-11T01:22:15.357Z","updated_at":"2024-11-11T01:22:16.533Z","avatar_url":"https://github.com/riverside.png","language":"PHP","readme":"# HeadCouch\nCouchDB PHP client\n\n| Build | Stable | License |\n| --- | --- | --- |\n| [![CI](https://github.com/riverside/HeadCouch/actions/workflows/test.yml/badge.svg)](https://github.com/riverside/HeadCouch/actions/workflows/test.yml) | [![Latest Stable Version](https://poser.pugx.org/riverside/head-couch/v/stable)](https://packagist.org/packages/riverside/head-couch) | [![License](https://poser.pugx.org/riverside/head-couch/license)](https://packagist.org/packages/riverside/head-couch) |\n\n#### Loading\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n```\n#### Transport\n- cURL\n```php\n$transport = \\HeadCouch\\Curl::newInstance('127.0.0.1', 5984)\n\t-\u003esetUsername('my_username')\n\t-\u003esetPassword('my_password');\n```\n- Socket\n```php\n$transport = \\HeadCouch\\Socket::newInstance('127.0.0.1', 5984)\n\t-\u003esetUsername('my_username')\n\t-\u003esetPassword('my_password');\n```\n- File\n```php\n$transport = \\HeadCouch\\File::newInstance('127.0.0.1', 5984)\n\t-\u003esetUsername('my_username')\n\t-\u003esetPassword('my_password');\n```\n#### Server\n```php\n$server = \\HeadCouch\\Server::newInstance($transport);\n\n// Accessing the root of a CouchDB instance\n$response = $server-\u003eping();\n\n// Requests a Universally Unique Identifier from the CouchDB instance\n$response = $server-\u003euuid();\n\n// Returns a list of all the databases\n$response = $server-\u003eallDbs();\n\n// List of running tasks\n$response = $server-\u003eactiveTasks();\n\n// Returns a list of all database events in the CouchDB instance\n$response = $server-\u003edbUpdates();\n\n// Gets the CouchDB log\n$response = $server-\u003elog();\n\n// Restarts the CouchDB instance\n$response = $server-\u003erestart();\n\n// Returns the statistics for the running server\n$response = $server-\u003estats();\n```\n#### Database\n```php\ntry {\n    $database = \\HeadCouch\\Database::newInstance($transport, 'db_name');\n} catch (\\HeadCouch\\Exception $e) {\n    echo $e-\u003egetMessage();\n}\n\n// Create database\n$response = $database-\u003ecreate();\n\n// Delete database\n$response = $database-\u003edelete();\n\n// Gets information about the specified database\n$response = $database-\u003eget();\n\n// Returns the HTTP Headers about the specified database\n$response = $database-\u003ehead();\n\n// Creates a new document in the specified database\n$response = $database-\u003epost(array(\n    'key1' =\u003e 'val1', \n    'key2' =\u003e 'val2'\n));\n```\n#### Document\n```php\ntry {\n    $document = \\HeadCouch\\Document::newInstance($transport, 'db_name', 'doc_name');\n} catch (\\HeadCouch\\Exception $e) {\n    echo $e-\u003egetMessage();\n}\n\n// Creates a new document\n$response = $document-\u003ecreate(array(\n    'key1' =\u003e 'val1', \n    'key2' =\u003e 'val2'\n));\n\n// Deletes the specified document from the database\n$response = $document-\u003edelete();\n\n// Returns document\n$response = $document-\u003eget();\n\n// Returns document's revision token\n$response = $document-\u003egetRevision();\n\n// Returns the HTTP Headers about the specified document\n$response = $document-\u003ehead();\n```\n#### Response\n```php\n$result = $response-\u003etoArray();\n// print_r($result);\n\n$result = $response-\u003etoObject();\n// get_object_vars($result);\n\n$result = $response-\u003etoString();\n// echo $result;\n```\n","funding_links":["https://www.paypal.me/Dimitar81"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friverside%2Fheadcouch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friverside%2Fheadcouch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friverside%2Fheadcouch/lists"}