From a43ec05ce3fba131e3d9d24bbb32d4f5f6312c89 Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 17 Jan 2026 10:07:11 -0500 Subject: [PATCH] Update Resources - Opensource --- Resources - Opensource.-.md | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/Resources - Opensource.-.md b/Resources - Opensource.-.md index c0c79a3..13131e6 100644 --- a/Resources - Opensource.-.md +++ b/Resources - Opensource.-.md @@ -13,5 +13,64 @@ Tailwind(https://tailwindcss.com/docs/installation/using-vite) ``` +PHP couchdb integration +``` + + "http://localhost:5984"]); + +// Use a specific database, creating it if it doesn't exist +$test_db = $server->useDb(["name" => "test", "create_if_not_exists" => true]); + +// Create a new document +$doc_data = ["name" => "Alice", "interests" => ["eating", "wondering"]]; +$new_doc = $test_db->create($doc_data); + +// Inspect the document returned by the server +print_r($new_doc); + +// Update the document +$new_doc->friends[] = "Cheshire Cat"; +$updated_doc = $new_doc->update(); + +// Delete the document +$updated_doc->delete(); +?> +``` + + +Direct calls to via CURL +``` + + "my_doc_id", "field1" => "value1", "field2" => "value2"]); +$ch = curl_init(); +curl_setopt($ch, CURLOPT_URL, $url); +curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); +curl_setopt($ch, CURLOPT_POSTFIELDS, $data); +curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); +curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); +$response = curl_exec($ch); +curl_close($ch); + +echo "Document created/updated: " . $response; +?> + +```