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
#
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庫!的詳細內容。更多資訊請關注PHP中文網其他相關文章!