1. Go to this page and download the library: Download tina4stack/ultipa 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/ */
tina4stack / ultipa example snippets
use Tina4\Ultipa\Client;
// from a URL...
$db = Client::fromUrl("ultipa://admin:password@localhost:60061/mygraph")->connect();
// ...or explicitly
$db = new Client(
host: "localhost",
port: 60061,
username: "admin",
password: "password",
graph: "mygraph"
);
// read — GQL text + optional named params
foreach ($db->query(
"MATCH (n:Person) WHERE n.age > \$min RETURN n.name AS name",
params: ["min" => 21]
) as $row) {
echo $row["name"], "\n";
}
// write — dml stats on success, throws on a bad statement
$r = $db->execute("INSERT (:Person {name: 'Alice', age: 30})");
echo $r->dmlStats["inserted_nodes"], "\n"; // 1
$db->close();
bash
php examples/seed.php ultipa://admin:PASSWORD@HOST:60061
# graph defaults to "default"; override with TINA4_ULTIPA_GRAPH