I used for that the following command line:
:POST /db/data/transaction/commit {"statements":[{"statement":"match n return n"}]}
when I set this query into a PHP variable, I get the following error:
Fatal error: Uncaught exception 'Neoxygen\NeoClient\Exception\Neo4jException' with message 'Neo4j Exception with code "Neo.ClientError.Statement.InvalidSyntax" and message "Invalid input ':' in C:\wamp\www\PhpProjectNeo4j1\vendor\neoxygen\neoclient\src\Extension\AbstractExtension.php on line 88
Could you please explain to me how can I add this command in PHP?
Have you looked at the NeoClient documentation ?
The single usage is :
$result = $client->sendCypherQuery('MATCH (n) RETURN n')->getResult();
If you want to export to json, there is no magic in the client, just use the nodes objects returned, create an array and encode it to json :
EDIT :
In order to have the result object, you need to have the ResponseFormatting service enabled :
example :