$client = new Client($app_id, $api_key);
/// Listing databases
$dbs = $client->dbs()->get();
echo "*** Listing databases: " . PHP_EOL;
if ($dbs) {
    foreach ($dbs as $db) {
        echo "      - " . $db->dbName . PHP_EOL;
    }
} else {
    echo "      No databases" . PHP_EOL;
}
$dbName = "test_php";
/// Adding new object to db "test_php"
$img = new Image("https://s3-eu-west-1.amazonaws.com/deepomatic-datasets/samples/image1.png");
$obj = new Object(array($img), array("name" => "puppy", "age" => 1));
$db = $client->db($dbName);
$task_index = $db->addObject($obj);
// an id has automatically been set to the object
// You need to wait for the task to complete before being able to use this object on the server side
$task_index->waitDone(true);
echo "*** Object " . $obj->id . " inserted to " . $db->dbName . PHP_EOL;
/// Retrieving our object in the db
echo "*** Getting object " . $obj->id . " from " . $db->dbName . PHP_EOL;
$obj_processed = $db->getObject($obj);
assert(compareObjects($obj_processed, $obj));
echo "*** Deleting object " . $obj->id . " from " . $db->dbName . PHP_EOL;
$task_delete = $db->deleteObject($obj_processed);
// use $task->refresh() to get the state of the task (waitDone call refresh in loop)
$task_delete->waitDone(true);
echo "*** Re-adding the object " . $obj->id . " to " . $db->dbName . PHP_EOL;
$db->addObject($obj)->waitDone(true);