Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

PHP Driver for Neo4j's Binary Protocol : Bolt

License

NotificationsYou must be signed in to change notification settings

graphaware/neo4j-bolt-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THIS REPOSITORY IS ARCHIVED.

Please head tohttp://github.com/neo4j-php orhttp://neo4j.com/developer/php for up-to-date PHP support for Neo4j.


Neo4j Bolt PHP

PHP low level Driver for Neo4j's Bolt Remoting Protocol

Build Status


References :

Requirements:

  • PHP5.6+
  • Neo4j3.0
  • PHP Sockets extension available
  • bcmath extension
  • mbstring extension

Installation

Require the package in your dependencies :

composer require graphaware/neo4j-bolt

Setting up a driver and creating a session

useGraphAware\Bolt\GraphDatabase;$driver = GraphDatabase::driver("bolt://localhost");$session =$driver->session();

Sending a Cypher statement

$session =$driver->session();$session->run("CREATE (n)");$session->close();// with parameters :$session->run("CREATE (n) SET n += {props}", ['name' =>'Mike','age' =>27]);

Empty Arrays

Due to lack of Collections types in php, there is no way to distinguish when an empty arrayshould be treated as equivalent Java List or Map types.

Therefore you can use a wrapper around arrays for type safety :

useGraphAware\Common\Collections;$query ='MERGE (n:User {id: {id} })        WITH n        UNWIND {friends} AS friend        MERGE (f:User {id: friend.name})        MERGE (f)-[:KNOWS]->(n)';$params = ['id' =>'me','friends' => Collections::asList([])];$this->getSession()->run($query,$params);// Or$query ='MERGE (n:User {id: {id} })        WITH n        UNWIND {friends}.users AS friend        MERGE (f:User {id: friend.name})        MERGE (f)-[:KNOWS]->(n)';$params = ['id' =>'me','friends' => Collections::asMap([])];$this->getSession()->run($query,$params);

TLS Encryption

In order to enable TLS support, you need to set the configuration option toREQUIRED, here an example :

$config = \GraphAware\Bolt\Configuration::newInstance()    ->withCredentials('bolttest','L7n7SfTSj0e6U')    ->withTLSMode(\GraphAware\Bolt\Configuration::TLSMODE_REQUIRED);$driver = \GraphAware\Bolt\GraphDatabase::driver('bolt://hobomjfhocgbkeenl.dbs.graphenedb.com:24786',$config);$session =$driver->session();

License

Copyright (c) 2015-2016 GraphAware Ltd

Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software is furnishedto do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.


About

PHP Driver for Neo4j's Binary Protocol : Bolt

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp