1

git project address church/neo4j

introduce

PHP-based neo4j library, source document link address neo4j http api

Installation environment requirements

  • PHP >= 7.4

Install

 composer require church/neo4j

usage

initialization

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

Check for phrases

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

open transaction

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

commit transaction

 $result = $transaction->commit();

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

Extend transaction validity

default expiry time is 60 seconds.
 $transaction->keepAlive();

rollback

 $transaction->rollback();

Open and commit transactions

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

unit test

 composer install
./vendor/bin/phpunit

protocol

MIT

church
3.6k 声望67 粉丝