PHP code example of hunnomad / ravendb

1. Go to this page and download the library: Download hunnomad/ravendb library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hunnomad / ravendb example snippets




$ravenDB = new RavenDB('https://your-server-url', 'your-database-name', '/path/to/ssl/certificate.pem');

$doc = [
    "Name" => "John Doe",
    "Email" => "[email protected]"
];

$id = "users/1";

$ravenDB->put($id, $doc);

$id = "users/1";
$document = $ravenDB->get($id);
print_r($document);

$query = "from Users where Name = 'John Doe'";
$results = $ravenDB->query($query);
print_r($results);

$id = "users/1";
$ravenDB->del($id);

try {
    $ravenDB->put($id, $doc);
} catch (Exception $e) {
    echo "Error: " . $e->getMessage();
}