分享一个图形数据库neo4j的PHP库!
时间:2022-07-28 14:54
git 项目地址 church/neo4j:https://github.com/fireqong/neo4j 介绍 基于PHP的neo4j库,可以帮助你更加便捷的连接neo4j的PHP库,源文档链接地址 neo4j http api:https://neo4j.com/docs/http-api/current/actions/ 安装环境需求 PHP >= 7.4 安装 用法 初始化 查询语句 开启事务 提交事务 延长事务有效期 回滚 开启和提交事务 单元测试 以上就是分享一个图形数据库neo4j的PHP库!的详细内容,更多请关注gxlsystem.com其它相关文章!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