File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments