Does any one know how to connect Magento 2 with Neo4j Graphical Database ?

There is a PHP client library (composer require graphaware/neo4j-php-client:^4.0) which i have updated in Magento project, resulted copied into the vendor directory.

Then i m trying to add following code which is not working properly.


require_once 'vendor/autoload.php';

use GraphAware\Neo4j\Client\ClientBuilder;

$client = ClientBuilder::create()
    ->addConnection('bolt', 'bolt://neo4j:password@localhost:7687')
$query = "MATCH (n:Person)-[:FOLLOWS]->(friend) RETURN n.name, collect(friend) as friends";
$result = $client->run($query);

foreach ($result->getRecords() as $record) {
    echo sprintf('Person name is : %s and has %d number of friends', $record->value('name'), count($record->value('friends'));

Any other libraries are required to get it work it properly?

  • where did you add the code you posted? It lloks like you are not following magento-standards. that's why it's not working. also what does "not work" mean exactly? anny error? stacktrace? – Philipp Sander Oct 5 '19 at 8:11
  • @PhilippSander, sorry i was not aware of the magento-standards..i will update question with all require info. thanks – MageSoftech Oct 5 '19 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.