PHP code example of graphaware / neo4j-response-formatter

1. Go to this page and download the library: Download graphaware/neo4j-response-formatter 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/ */

    

graphaware / neo4j-response-formatter example snippets


$client = ClientBuilder::create()
	->addDefaultLocalConnection()
	->setAutoFormatResponse(true)
	->enableNewFormattingService()
	->build();

$response = $client->sendCypherQuery('MATCH (n) OPTIONAL MATCH (n)-[r]-() RETURN n,r');
// here we only expect one result
$result = $response->getResult();

// The result object holds nodes, relationships and table format

$nodes = $result->getNodes();
$relationships = $result->getRelationships();

// If you expect multiple results, like for preparedTransactions

$results = $response->getResults();

// Using the table

$table = $result->getTable();
$rows = $table->getRows();
print_r($rows);