1. Go to this page and download the library: Download bingher/tugraph 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/ */
bingher / tugraph example snippets
use bingher\tugraph\TuGraph;
$config = [
'uri' => '<API Base Uri>',
'user' => '<User>',
'password' => '<Password>',
'graph' => '<Graph name,default:empty>',
];
$tu = new TuGraph($config);
$sql = 'Match p = (n)-[]-(m) Return p';
$result = $tu->graph('<GraphName>')->call($sql);
use bingher\tugraph\TuGraph;
use function WikibaseSolutions\CypherDSL\node;
use function WikibaseSolutions\CypherDSL\query;
$config = [
'uri' => '<API Base Uri>',
'user' => '<User>',
'password' => '<Password>',
'graph' => '<Graph name,default:empty>',
];
$tu = new TuGraph($config);
$tom = node("Person")->withProperties(["name" => "Tom Hanks"]);
$coActors = node();
$statement = query()
->match($tom->relationshipTo(node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN"))
->returning($coActors->property("name"))
->build();
$result = $tu->graph('<GraphName>')->call($statement);