How to properly loop and display Neo4j database records from an array in php

Am working with neo4j database via this project below.
source GitHub - neo4j-php/neo4j-php-client: Php client and driver for neo4j database

Here is my code


<?php


require ('vendor/autoload.php');
$client = Laudis\Neo4j\ClientBuilder::create()
    ->addHttpConnection('backup', 'http://neo4j:foodisgood56@localhost')
    ->addBoltConnection('default', 'bolt://neo4j:foodisgood56@localhost')
    ->setDefaultConnection('default')
    ->build();
$query = $client->run('MATCH (n:Dept1) RETURN n LIMIT 25');
print_r($query );

/*
echo $json = json_decode($query, true);
foreach($json as $v1){

echo $v1['location'];
echo $v1['dname'];
echo $v1['deptno'];

}
*/

?>

when print a records in the array, i have the following output/records.


Ds\Vector Object ( [0] => Ds\Map Object ( [0] => Ds\Pair Object ( [key] => n [value] => Array ( [location] => Hyderabad [dname] => Accounting [deptno] => 10 ) ) ) [1] => Ds\Map Object ( [0] => Ds\Pair Object ( [key] => n [value] => Array ( [location] => Hyderabad1 [dname] => Accounting1 [deptno] => 11 ) ) ) [2] => Ds\Map Object ( [0] => Ds\Pair Object ( [key] => n [value] => Array ( [location] => Hyderabad2 [dname] => Accounting2 [deptno] => 12 ) ) ) )

Here is my issue
Please how, can I access or loop through the array and display values for location, dname and deptno

It seems you are getting list of maps as response. you need to iterate the list and that gives you a map to get the required values

please do you have an idea on how I can iterate it in php to get all the values between Thanks.

From the documentation on the page you provided

### Reading a Result

A result is a simple vector, with hashmaps representing a record.

foreach ($client->run('UNWIND range(1, 9) as x RETURN x') as $item) { echo $item->get('x'); }

so you might want to try

### Reading a Result

foreach ($query as $item) { 
    echo $item->get('location'); 
    echo $item->get('dname'); 
    echo $item->get('deptno'); 
}