PHP code example of church / neo4j

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

    

church / neo4j example snippets


$app = new \Church\Neo4j\Application("http://127.0.0.1:7474", "neo4j", "neo4j");
$app->discovery();


$statement = (new \Church\Neo4j\Statement('CREATE (n $props) RETURN n)'))->params([
    'props' => [
        'name' => 'test'
    ]   
]);

$statements = \Church\Neo4j\StatementRepository::add($statement);
$transaction = $app->transaction($statements);
$transaction->begin();

$result = $transaction->commit();

if ($result->getRawResponse()->getStatusCode() == 200) {
    print_r($result->getData());
}

 
$transaction->keepAlive(); 
 
$transaction->rollback();
 
$result = $transaction->beginAndCommit();
print_r($result);