教堂/neo4j

PHP的neo4j SDK

1.2 2022-07-25 02:51 UTC

This package is auto-updated.

Last update: 2024-09-25 07:51:12 UTC


README

这是PHP的neo4j SDK

要求

  • PHP >= 7.4

安装

composer require church/neo4j

使用

初始化

$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());
}

保持连接

默认过期时间为60秒。

$transaction->keepAlive(); 

回滚

$transaction->rollback();

开始并提交

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

测试

composer install
./vendor/bin/phpunit

协议

MIT