neoxygen/graphenedb-client

Http Client for the GrapheneDB Neo4j as as Service

0.1.3 2014-10-23 21:30 UTC

This package is not auto-updated.

Last update: 2024-04-23 00:42:44 UTC


README

A PHP Client for the popular GrapheneDB | Neo4j as a Service.

img

Latest Stable Version License Build Status

Requirements

Usage

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');

Create a Neo4j database instance

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.

Listing available versions :

$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
                )

        )

)

Getting all your databases

$databases = $client->getDatabases();

This will return you a collection of Neoxygen\GrapheneDBClient\Database instances.

Getting a specific database

You need to provide the name of your database :

$db = $client->getDatabase('test');

This will return you an instance of Neoxygen\GrapheneDBClient\Database.

Deleting a 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.

Deleting all databases

$client->deleteAllDatabases();

This will return you true, or throw an exception if an error occured on the GrapheneDB server.

The Database class

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.

Author

Christophe Willemsen Twitter | Github

License

This library is licensed under the MIT License, check out the LICENSE file packaged with the source code.

Bugs & Contributions

Simple report & PR on the Github Repository.