https://github.com/graphaware/neo4j-php-response-formatter
Advanced Neo4j Http Response Formatter Extension for NeoClient
https://github.com/graphaware/neo4j-php-response-formatter
Last synced: 11 months ago
JSON representation
Advanced Neo4j Http Response Formatter Extension for NeoClient
- Host: GitHub
- URL: https://github.com/graphaware/neo4j-php-response-formatter
- Owner: graphaware
- License: mit
- Created: 2015-07-30T23:32:44.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-08-06T21:12:02.000Z (over 10 years ago)
- Last Synced: 2025-02-22T20:19:20.975Z (11 months ago)
- Language: PHP
- Size: 168 KB
- Stars: 1
- Watchers: 23
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Neo4j Response Formatter Service for NeoClient
Advanced formatting based on the Neo4j Rest API Http Response format.
### Features
* Response object bootstrapped by a `PSR-7` Http Message
* In-memory graph representation with nodes and relationships objects
* Table format
* Smart getter
### Usage
The current usage in NeoClient is optional for avoiding backwards incompatible changes, this will become the default formatting
service in NeoClient v4.
Enabling the GraphAware's formatting service:
```php
$client = ClientBuilder::create()
->addDefaultLocalConnection()
->setAutoFormatResponse(true)
->enableNewFormattingService()
->build();
```
From now, all the responses you will receive will be instances of `GraphAware\NeoClient\Formatter\Response`.
#### Getting results
```php
$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);
```
More doc to come...
---
License MIT
---