PHPackages                             the-don-himself/gremlin-ogm - 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. the-don-himself/gremlin-ogm

ActiveLibrary

the-don-himself/gremlin-ogm
===========================

A PHP Object Graph Mapper for Tinkerpop 3+ compatible Graph Databases (JanusGraph, Neo4j, etc.) that allows you to persist data and run gremlin queries.

v0.5.1(5y ago)171.9k2[1 issues](https://github.com/The-Don-Himself/gremlin-ogm/issues)MITPHPPHP ^7.2

Since Jan 4Pushed 5y ago2 watchersCompare

[ Source](https://github.com/The-Don-Himself/gremlin-ogm)[ Packagist](https://packagist.org/packages/the-don-himself/gremlin-ogm)[ RSS](/packages/the-don-himself-gremlin-ogm/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (11)Used By (0)

gremlin-ogm
===========

[](#gremlin-ogm)

A PHP Object Graph Mapper for Tinkerpop 3+ compatible Graph Databases (JanusGraph, Neo4j, etc.) that allows you to persist data and run gremlin queries.

Check out the TwitterGraph folder for an elaborate example of how to use gremlin-ogm to graph Twitter in a Graph Database.

Usage
-----

[](#usage)

Configure a Graph connection. This is simply a proxy to the underlying gremlin-server client for php aka [brightzone/gremlin-php](https://github.com/PommeVerte/gremlin-php) so you can check out the connection Class for configuration defaults and options Brightzone\\GremlinDriver\\Connection. For testing and development, I suggest something like the below

```
$options = [
    'host' => '127.0.0.1',
    'port' => 8182,
    'username' => null,
    'password' => null,
    'ssl' => [
      'ssl' => [
        'verify_peer' => false,
        'verify_peer_name' => false
      ]
    ],
    'graph' => 'graph',
    'timeout' => 10,
    'emptySet' => true,
    'retryAttempts' => 3
];

```

After configuring options, initiate a Graph connection

```
use TheDonHimself\GremlinOGM\GraphConnection;

....

$graph = (new GraphConnection($options))->init();
$graph_connection = $graph->getConnection();

```

At this point you can open a connection to the Graph database and send gremlin-queries to it as shown.

```
// Open Connection
$graph_connection->open();

// Query Number of Vertices in Graph
$resultSet = $graph_connection->send('g.V().count()');

// Close Connection
$graph_connection->close();

```

Again these are just proxies to the underlying brightzone/gremlin-php library, so what does gremlin-ogm do? Gremlin-OGM helps you map PHP objects to Graph Vertexes, Edges, Properties and Indexes. It also provides a way to validate that mapping and point out areas where the schema fails. Moreover, the library attempts to create a cross-vendor abstraction layer because different providers might give different ways to execute gremlin commands.

#### Current Tested &amp; Supported Vendors:

[](#current-tested--supported-vendors)

- Amazon Neptune
- Azure Cosmos DB
- Datastax Enterprise Graph
- JanusGraph on Compose
- JanusGraph Self-Hosted
- Neo4j
- OrientDB

To tell the library of a specific vendor extend the options array as shown for self-hosted

```
$options = [
....
    'vendor' => [
      'name' => '_self',
      'database' => 'janusgraph',
      'version' => '0.3.1'
    ],
....
];

```

Omiting the version will make the library assume the latest.

An example configuration for JanusGraph on Compose would look like this.

```
$options = [
....
    'vendor' => [
      'name' => 'compose',
      'graph' => 'twitter',
      'database' => 'janusgraph',
      'version' => '0.3.1'
    ],
....
];

```

An example configuration for CosmosDB on Azure would look like this.

```
$options = [
....
    'vendor' => [
      'name' => 'azure',
      'database' => 'cosmosdb'
    ],
....
];

```

Vendor information is critical to the library so as to know whether to enable certain features like [bindings](tinkerpop.apache.org/docs/current/reference/#parameterized-scripts) which is does by default and may not work in all situations. Submitted vendor information can now be gotten as an array under the graph object

```
$vendor = $graph->getVendor();

```

Sample Usage
------------

[](#sample-usage)

Please Check Out [The-Don-Himself/twitter-graph](https://github.com/The-Don-Himself/twitter-graph), for a full working sample code of how to use this library to map your Twitter connection and tweets onto a compatible graph database.

GraphQL
-------

[](#graphql)

You might also be interested in [The-Don-Himself/graphql2gremlin](https://github.com/The-Don-Himself/graphql2gremlin), an attempt to create a standard around transforming GraphQL queries to Gremlin Traversals.

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 90.5% 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 ~101 days

Recently: every ~137 days

Total

10

Last Release

2091d ago

PHP version history (3 changes)v0.0.1PHP &gt;=7.0

v0.1PHP ^7.0

v0.5.0PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a595ef2b0aa9f2c5a3c7040187ce12dd426f1db4149e1849863d83e526012b83?d=identicon)[The-Don-Himself](/maintainers/The-Don-Himself)

---

Top Contributors

[![The-Don-Himself](https://avatars.githubusercontent.com/u/5156320?v=4)](https://github.com/The-Don-Himself "The-Don-Himself (67 commits)")[![juhasev](https://avatars.githubusercontent.com/u/10157670?v=4)](https://github.com/juhasev "juhasev (7 commits)")

---

Tags

neo4jorientdbgraphjanusgraphgremlin-phpgremlin-ogmAmazon NeptuneAzure Cosmos DBDatastax Enterprise Graph

### Embed Badge

![Health badge](/badges/the-don-himself-gremlin-ogm/health.svg)

```
[![Health](https://phpackages.com/badges/the-don-himself-gremlin-ogm/health.svg)](https://phpackages.com/packages/the-don-himself-gremlin-ogm)
```

###  Alternatives

[vinelab/neoeloquent

Laravel wrapper for the Neo4j graph database REST interface

65292.8k1](/packages/vinelab-neoeloquent)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

183593.5k24](/packages/laudis-neo4j-php-client)[graphaware/neo4j-common

Common Utilities library for Neo4j

24874.8k22](/packages/graphaware-neo4j-common)[neo4j/neo4j-bundle

Symfony integration for Neo4j

8271.9k](/packages/neo4j-neo4j-bundle)[ulobby/neoeloquent

Laravel wrapper for the Neo4j graph database REST interface

4473.0k](/packages/ulobby-neoeloquent)[wikibase-solutions/php-cypher-dsl

A query builder for the Cypher query language

1850.6k3](/packages/wikibase-solutions-php-cypher-dsl)

PHPackages © 2026

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