Client for the Neo4j ReST API - built upon Guzzle (PHP)
PHP Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


UpDown - A simple PHP client library for the Neo4j ReST API

UpDown is momently a WIP ! Beta will be lauched soon...

UpDown is a simple PHP client that wraps the Neo4j ReST API. UpDown is based upon Guzzle.


Build Status


UpDown's goal is to provide a flexible way to make calls to your Neo4j ReST API.

UpDown is aimed to make your requests and responses to the API easier and only that.


Installation is now a piece of cake thanks to Composer

Add the UpDown package to your dependencies


"require": {
    .... ,
    "neoxygen/updown": "dev-master"


UpDown provides you a main ClientService and uses the Command pattern.

Instantiate the Client

First you need to instantiate the Service Factory with and to provide some basic configuration.

Note: This step will be made easier in the future


require 'vendor/autoload.php';

use Neoxygen\UpDown\ClientService;

$dbParams = array('host' => 'localhost', 'port' => 7474);
$service = new ClientService($dbParams);
$client = $service->getClient();

Creating your first request with the help of the commands

To make the requests to the Neo4j API, you need to call a Command that will make the request.

For example, if you want to GET the available API action links, you can do this by calling the discoverActions command.

In the backend, this command make a request to the endpoint of the API and return you the response with all the available links.

The API is discoverable, and UpDown is built with this discoverability in mind, so at the bootstrap it will first fetch the available links at the endpoint, this way if the API URI scheme change, this library will not break :

$command = $client->getCommand('discoverActions');
try {
} catch ( UpDownException $e ) {


This call will return you in case of success something like this :

  'extensions' => 
      'CypherPlugin' => 
          'execute_query' => string '' (length=73)
      'GremlinPlugin' => 
          'execute_script' => string '' (length=75)
  'node' => string '' (length=39)
  'reference_node' => string '' (length=41)
  'node_index' => string '' (length=45)
  'relationship_index' => string '' (length=53)
  'extensions_info' => string '' (length=38)
  'relationship_types' => string '' (length=53)
  'batch' => string '' (length=40)
  'cypher' => string '' (length=41)
  'neo4j_version' => string '1.8.M06-1-g87a127a' (length=18)

By default, the response will be returned to you in a php array. Other options will come later.

Some examples:

Creating a node :

$node = array(
  'id' => uniqid(),
  'name' => 'neo',
  'job' => 'actor'
$cmd = $client->getCommand('Node\createNode');
$xc = $client->execute($cmd);
$result = $cmd->getResult();

Adding a node to an index

// You need the full uri of the node (_self_)
// let's say we add the node to the index after the above creation
$uri = $result['self'];
$cmd = $client->getCommand('Node\addNodeToIndex');
$cmd->setIndex('actors'); // The index name
$cmd->setKey('name'); // The index key
$cmd->setValue($node['name']); // The index key value
$cmd->setUri($uri); // The node uri
$xc = $client->execute($cmd);
$result = $cmd->getResult();

// If you want to add a unique index, just add the following before the execution of the command

Available commands

Here you find a list of the currently available commands :

  • discoverActions (should change to discoverApi in the future)
  • Node\createNodee
  • Node\createEmptyNode
  • Node\findNodeById
  • Node\deleteNode
  • Node\batchNodeCreate (should be removed in the future in favor of a generic batch command)
  • searchNodeIndex (should move to Index\searchNodeIndex)
  • Index\listNodeIndexes
  • Index\createNodeIndex
  • Index\deleteNodeIndex