A PHP Client for the popular GrapheneDB | Neo4j as a Service.
- A GrapheneDB account, you can create one here : https://app.graphenedb.com/signup
Require the library with composer :
composer require neoxygen/graphenedb-client
Create the client by providing your GrapheneDB account e-mail and password :
require_once 'vendor/autoload.php';
use Neoxygen\GrapheneDBClient\GrapheneDBClient;
$client = new GrapheneDBClient('graphista@neo4jrocks.com', 'SuPeRp@sSwOrD');
You need to pass a name for your database, and optionally a neo4j version :
$myNewDB = $client->createDatabase('test');
By default, the latest neo4j version will be used (currently 2.1.5)
This will return you a Neoxygen\GrapheneDBClient\Database
instance, for the available methods of this class read the section The Database class
.
$client->getVersions();
Array
(
[default] => v215
[versions] => Array
(
[0] => Array
(
[version] => v198
[label] => Neo4j Community Edition 1.9.8
)
[1] => Array
(
[version] => v204
[label] => Neo4j Community Edition 2.0.4
)
[2] => Array
(
[version] => v215
[label] => Neo4j Community Edition 2.1.5
)
)
)
$databases = $client->getDatabases();
This will return you a collection of Neoxygen\GrapheneDBClient\Database
instances.
You need to provide the name of your database :
$db = $client->getDatabase('test');
This will return you an instance of Neoxygen\GrapheneDBClient\Database
.
You need to provide the id
of the database you want to delete :
$db = $client->getDatabase('test');
$client->deleteDatabase($db->getId());
This will return you true, or throw an exception if the database does not exist.
$client->deleteAllDatabases();
This will return you true, or throw an exception if an error occured on the GrapheneDB server.
The Neoxygen\GrapheneDBClient\Database
offers you methods to have informations about your GrapheneDB Neo4j instances :
$db = $client->getDatabase('test');
echo $db->getId(); //42354265476534
echo $db->getName(); // test
echo $db->getNodesLimit(); // 1000
echo $db->getDbLocation(); // us-east-1-New York
For the list of all available methods, check the Neoxygen\GrapheneDBClient\Database
source code.
Christophe Willemsen Twitter | Github
This library is licensed under the MIT License, check out the LICENSE
file packaged with the source code.
Simple report & PR on the Github Repository.