PHPackages                             chekun/gremlin-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. chekun/gremlin-php

ActiveLibrary

chekun/gremlin-php
==================

gremlin-server client for php

1.0.0(10y ago)024PHP

Since Jun 24Pushed 10y ago1 watchersCompare

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

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

This is a Gremlin server client for PHP. **Supported versions : M9-RC3**

Changes
=======

[](#changes)

There are many changes but bellow are the most noticeable if you've used rexpro-php before

- Client now throw errors that you will need to catch
- Connection params have changes
- Messages class has been revamped and is independant from Connection (see documentation on how to use this)
- Unit testing will require some more configuration
- Runs sessionless by default (rexpro-php 2.3 &amp; 2.4+ ran with sessions as the default)
- Gremlin code change g.V/E should now be written as g.V()/E()

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

[](#installation)

### PHP Gremlin-Server Client

[](#php-gremlin-server-client)

##### For Gremlin-Server 3.0.0-M5+

[](#for-gremlin-server-300-m5)

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

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

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

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

Namespace
=========

[](#namespace)

The Connection class exists within the `rexpro` namespace. (history: rexpro used to be the old protocol used by the driver in Tinkerpop2). This means that you have to do either of the two following:

```
require_once('vendor/autoload.php');
use \brightzone\rexpro\Connection;

$db = new Connection;
```

Or

```
require_once('vendor/autoload.php');

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

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

$result = $db->send('g.V(2)');
//do something with result
$db->close();
```

Note that "graph" is the name of the graph configured in gremlin-server (not the reference to the traversal which is `g = graph.traversal()`)

Example 1 bis (Writing the same with message object) :

```
$db = new Connection;
//you can set $db->timeout = 0.5; if you wish
$db->open('localhost', 'graph');

$db->message->gremlin = 'g.V(2)';
$result = $db->send(); //automatically fetches the message
//do something with result
$db->close();
```

Example 2 (with bindings) :

```
$db = new Connection;
$db->open('localhost:8182', 'graph');

$db->message->bindValue('CUSTO_BINDING', 2);
$result = $db->send('g.V(CUSTO_BINDING)'); //mix between Example 1 and 1B
//do something with result
$db->close();
```

Example 3 (with session) :

```
$db = new Connection;
$db->open('localhost:8182');
$db->send('cal = 5+5', 'session');
$result = $db->send('cal', 'session'); // result = [10]
//do something with result
$db->close();
```

Example 4 (transaction) :

```
$db = new Connection;
$db->open('localhost:8182','graphT');

$db->transactionStart();

$db->send('n.addVertex("name","michael")');
$db->send('n.addVertex("name","john")');

$db->transactionStop(FALSE); //rollback changes. Set to true to commit.
$db->close();
```

Note that "graphT" above refers to a graph that supports transactions. And that transactions start a session automatically.

Example 5 (Using message object) :

```
$message = new Messages;
$message->gremlin = 'g.V()';
$message->op = 'eval';
$message->processor = '';
$message->setArguments([
				'language' => 'gremlin-groovy',
				// .... etc
]);
$message->registerSerializer('\brightzone\rexpro\serializers\Json');

$db = new Connection;
$db->open();
$result = $db->send($message);
//do something with result
$db->close();
```

Of course you can affect the current db message in the same manner through $db-&gt;message.

Adding Serializers
==================

[](#adding-serializers)

This library comes with a Json and an unused legacy Msgpack serializer. Any other serializer that implements SerializerInterface can be added dynamically with:

```
$db = new Connection;
$serializer = $db->message->getSerializer() ; // returns an instance of the default JSON serializer
echo $serializer->getName(); // JSON
echo $serializer->getMimeType(); // application/json

$db->message->registerSerializer('namespace\to\my\CustomSerializer', TRUE); // sets this as default
$serializer = $db->message->getSerializer(); // returns an instance the CustomSerializer serializer (default)
$serializer = $db->message->getSerializer('application/json'); // returns an instance the JSON serializer
```

You can add many serializers in this fashion. When gremlin-server responds to your requests, gremlin-client-php will be capable of using the appropriate one to unserialize the message.

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

[](#unit-testing)

You will then need to run gremlin-server with the following configuration file : src/tests/gremlin-server-php.yaml

Just copy this file to `/conf/`And run the server using :

```
bin/gremlin-server.sh conf/gremlin-server-php.yaml
```

Note that you will not be able to test Transactions without a titan09-SNAPSHOT installation and custom configuration. Start an issue if you need more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 97.9% 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.

###  Release Activity

Cadence

Every ~10 days

Total

2

Last Release

3971d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/845df2060f6ad07940b905375dbc19553cb9eae1fa7aeb91ef0afdd5a06382a4?d=identicon)[chekun](/maintainers/chekun)

---

Top Contributors

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

---

Tags

drivergremlinrexpro-phprexprogremlin-server

### Embed Badge

![Health badge](/badges/chekun-gremlin-php/health.svg)

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

###  Alternatives

[brightzone/gremlin-php

gremlin-server client for php

74194.5k4](/packages/brightzone-gremlin-php)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)[alchemy/binary-driver

A set of tools to build binary drivers

19110.9M39](/packages/alchemy-binary-driver)[babenkoivan/elastic-scout-driver

Elasticsearch driver for Laravel Scout

2773.8M5](/packages/babenkoivan-elastic-scout-driver)[babenkoivan/elastic-scout-driver-plus

Extension for Elastic Scout Driver

2862.8M1](/packages/babenkoivan-elastic-scout-driver-plus)

PHPackages © 2026

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