介绍
基于php的neo4j库,可以帮助你更加便捷的连接neo4j的php库,源文档链接地址 neo4j http api:https://neo4j.com/docs/http-api/current/actions/
安装环境需求
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());}
延长事务有效期
default expiry time is 60 seconds.$transaction->keepalive();
回滚
$transaction->rollback();
开启和提交事务
$result = $transaction->beginandcommit();print_r($result);
单元测试
composer install./vendor/bin/phpunit
以上就是分享一个neo4j(图形数据库)的php库!的详细内容。
