PHPackages                             brightzone/rexpro-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. brightzone/rexpro-php

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

brightzone/rexpro-php
=====================

rexpro client for php

763PHP

Since Sep 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/PommeVerte/rexpro-php)[ Packagist](https://packagist.org/packages/brightzone/rexpro-php)[ RSS](/packages/brightzone-rexpro-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

#### Please note that the current version of TinkerPop (TP) is TP3. You can find a driver for that version [here](https://github.com/PommeVerte/gremlin-php). If you are already running a TP2 project and want a driver for that version then read on.

[](#please-note-that-the-current-version-of-tinkerpop-tp-is-tp3-you-can-find-a-driver-for-that-version-here-if-you-are-already-running-a-tp2-project-and-want-a-driver-for-that-version-then-read-on)

This is a rexpro client for PHP. It's main purpose was for it to be integrated into frameworks, and therefore it will fail silently and not throw any exceptions. See Error handling section

Installation
============

[](#installation)

### MsgPack (optional)

[](#msgpack-optional)

rexpro-php does not require MsgPack anymore as it can also serialize using json. If you wish you can still use it though: [MsgPack](http://msgpack.org/) .

Install MsgPack from PEAR:

```
sudo pecl install msgpack-beta
sudo sh -c 'echo "extension=msgpack.so" > /etc/php5/mods-available/msgpack.ini'
sudo php5enmod msgpack
```

### PHP Rexster Client

[](#php-rexster-client)

##### For TP3 and a Gremlin-Server version of this client go here :

[](#for-tp3-and-a-gremlin-server-version-of-this-client-go-here-)

##### For Rexster 2.4+

[](#for-rexster-24)

Prefered method is trough composer. Add the following to your **composer.json** file:

```
{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/PommeVerte/rexpro-php.git"
        }
    ],
    "require": {
        "brightzone/rexpro": "master"
    }
}
```

If you just want to pull and use the library do:

```
git clone https://github.com/PommeVerte/rexpro-php.git
cd rexpro-php
composer install --no-dev # required to set autoload files
```

##### For Rexster 2.3

[](#for-rexster-23)

Prefered method is through composer. Add the following to your **composer.json** file:

```
{
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/PommeVerte/rexpro-php.git"
        }
    ],
    "require": {
        "brightzone/rexpro": "2.3"
    }
}
```

If you just want to pull and use the library do:

```
git clone https://github.com/PommeVerte/rexpro-php.git -b 2.3
cd rexpro-php
composer install --no-dev # required to set autoload files
```

Error Handling
==============

[](#error-handling)

The PHP Client does not throw Exceptions. It was built with the goal of being wrapped into a PHP framework and therefore fails silently (you can still get errors by checking method return values).

For instance:

```
if($db->open('localhost:8184','tinkergraph',null,null) === false)
  throw new Exception($db->error->code . ' : ' . $db->error->description);
$db->script = 'g.v(2)';
$result = $db->runScript();
if($result === false)
   throw new Exception($db->error->code . ' : ' . $db->error->description);
//do something with result
```

Namespace
=========

[](#namespace)

The Connection class exists within the `rexpro` namespace. This means that you have to do either of the two following:

```
require_once 'rexpro-php/src/Connection.php';
use \brightzone\rexpro\Connection;

$db = new Connection;
```

Or

```
require_once 'rexpro-php/src/Connection.php';

$db = new \brightzone\rexpro\Connection;
```

Serializer
==========

[](#serializer)

rexpro-php will use the pecl msgpack extention by default. But if it isn't installed on the system it will automatically revert to using JSON.

If you wish to force a specific serializer type you may do so like this:

```
$db = new Connection;
echo $db->getSerializer(); // will echo 'MSGPACK'
$db->setSerializer(Messages::SERIALIZER_JSON);
echo $db->getSerializer(); // will echo 'JSON'
// do something with $db Connection Object.
```

Examples
========

[](#examples)

You can find more information by reading the API in the wiki.

Here are a few basic usages.

Example 1:

```
$db = new Connection;
//you can set $db->timeout = 0.5; if you wish
$db->open('localhost:8184','tinkergraph',null,null);
$db->script = 'g.v(2)';
$result = $db->runScript();
//do something with result
$db->close();
```

Example 2 (with bindings):

```
$db = new Connection;
$db->open('localhost:8184','tinkergraph','username','password');

$db->script = 'g.v(CUSTO_BINDING)';
$db->bindValue('CUSTO_BINDING',2);
$result = $db->runScript();
//do something with result
$db->close();
```

Example 3 (sessionless):

```
$db = new Connection;
$db->open('localhost:8184');
$db->script = 'g.v(2).map()';
$db->graph = 'tinkergraph'; //need to provide graph
$result = $db->runScript(false);
//do something with result
$b->close();
```

Example 4 (transaction):

```
$db = new Connection;
$db->open('localhost:8184','neo4jsample',null,null);

$db->transactionStart();

$db->script = 'g.addVertex([name:"michael"])';
$result = $db->runScript();
$db->script = 'g.addVertex([name:"john"])';
$result = $db->runScript();

$db->transactionStop(true);//accept commit of changes. set to false if you wish to cancel changes
$db->close();
```

Unit testing
============

[](#unit-testing)

If your test rexster server uses credentials for loging in you will need to run the following to set up proper credentials for tests:

```
DBUSER= DBPASS= phpunit src/tests/
```

Using env variables allows us to pass these arguments to a CI environment if needed.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/1003540c62e92cfee08bbdbd7d338a4a625f2fd9dffa90bf15963c42fc74ea78?d=identicon)[PommeVerte](/maintainers/PommeVerte)

---

Top Contributors

[![dmill-bz](https://avatars.githubusercontent.com/u/1415875?v=4)](https://github.com/dmill-bz "dmill-bz (138 commits)")

### Embed Badge

![Health badge](/badges/brightzone-rexpro-php/health.svg)

```
[![Health](https://phpackages.com/badges/brightzone-rexpro-php/health.svg)](https://phpackages.com/packages/brightzone-rexpro-php)
```

###  Alternatives

[milo/hydrator

Hydrates object from array, exports object to array

2571.9k](/packages/milo-hydrator)[logoscon/acf-plus

Common utility classes for the Advanced Custom Fields (Pro) plugin on WordPress.

1023.3k](/packages/logoscon-acf-plus)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
