Skip to content

Commit 7cf06a0

Browse files
PratikshaPratiksha
authored andcommitted
winp
1 parent bc53a5c commit 7cf06a0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/abc.php

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
3+
require __DIR__ . '/../vendor/autoload.php';
4+
5+
use Neo4j\QueryAPI\Neo4jQueryAPI;
6+
use Neo4j\QueryAPI\Objects\Authentication;
7+
use Neo4j\QueryAPI\Configuration;
8+
9+
$neo4jUsername = 'neo4j';
10+
$neo4jPassword = 'OXDRMgdWFKMcBRCBrIwXnKkwLgDlmFxipnywT6t_AK0';
11+
$neo4jUrl = 'https://bb79fe35.databases.neo4j.io';
12+
13+
$auth = Authentication::basic($neo4jUsername, $neo4jPassword);
14+
15+
$config = new Configuration(baseUri: $neo4jUrl);
16+
17+
$neo4j = Neo4jQueryAPI::login(
18+
$neo4jUrl,
19+
$auth,
20+
$config
21+
);
22+
23+
$cypher = 'MATCH (n:Movie) RETURN n LIMIT 25';
24+
$resultSet = $neo4j->run($cypher);
25+
26+
foreach ($resultSet as $row) {
27+
$node = $row['n'];
28+
29+
$properties = $node->getProperties();
30+
31+
if (isset($properties['title'])) {
32+
echo "Movie Title: " . $properties['title'] . "\n";
33+
} else {
34+
echo "Title not found.\n";
35+
}
36+
37+
if (isset($properties['released'])) {
38+
echo "Movie Year: " . $properties['released'] . "\n";
39+
} else {
40+
echo "Year not found.\n";
41+
}
42+
}

0 commit comments

Comments
 (0)