PHPackages                             rnd/gremlin-dsl - 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. rnd/gremlin-dsl

Abandoned → [specialweb/gremlin-dsl](/?search=specialweb%2Fgremlin-dsl)Library

rnd/gremlin-dsl
===============

Gremlin DSL PHP integration

1.0.1(3y ago)01971[4 PRs](https://github.com/SpecialWeb/gremlin-dsl/pulls)MITPHPPHP &gt;=8.0

Since Sep 17Pushed 3y ago1 watchersCompare

[ Source](https://github.com/SpecialWeb/gremlin-dsl)[ Packagist](https://packagist.org/packages/rnd/gremlin-dsl)[ RSS](/packages/rnd-gremlin-dsl/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (6)Versions (16)Used By (0)

PHP Gremlin DSL implementation
==============================

[](#php-gremlin-dsl-implementation)

[![PHPCS](https://camo.githubusercontent.com/e0f696878759157d853f6e4a8e7f18bacce05bd60901b5c08dde23641bec8b2f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f5370656369616c5765622f6772656d6c696e2d64736c2f50485043533f6c6162656c3d5048504353)](https://github.com/SpecialWeb/gremlin-dsl/actions?query=workflow%3APHPCS)[![PHPUnit](https://camo.githubusercontent.com/77929718f5d6f139064c6ca7cb46344f75e08d1f07086f19fd698bbabdee02be/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f5370656369616c5765622f6772656d6c696e2d64736c2f504850556e69743f6c6162656c3d504850556e6974)](https://github.com/SpecialWeb/gremlin-dsl/actions?query=workflow%3APHPCS)[![License](https://camo.githubusercontent.com/fd491947c8698f3dc920c4bda0f02898bb9415a592fe77e5523351e0b804568f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f5370656369616c5765622f6772656d6c696e2d64736c)](LICENSE.md)[![Downloads](https://camo.githubusercontent.com/64273b1c8591ea882cb604d9d78d4fd2976b2855aa2c60c6b07a432630be35e3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370656369616c7765622f6772656d6c696e2d64736c)](https://packagist.org/packages/specialweb/gremlin-dsl)[![Latest version](https://camo.githubusercontent.com/00126d248eaf8dc7625c7056ca83a0526ec2ebc743e81d5621b3bf4f22e4cf62/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370656369616c7765622f6772656d6c696e2d64736c)](https://packagist.org/packages/specialweb/gremlin-dsl)[![codecov](https://camo.githubusercontent.com/774f25cff6b7e1f29708d037e817e61284bd7d107a5afefdb98b92cd971ba3c4/68747470733a2f2f636f6465636f762e696f2f67682f5370656369616c5765622f6772656d6c696e2d64736c2f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/SpecialWeb/gremlin-dsl)

Information
-----------

[](#information)

As the [original repository](https://github.com/RedaktionsNetzwerk-Deutschland/gremlin-dsl) was discontinued this is the continuing package to work with.

Introduction
------------

[](#introduction)

Gremlin is a graph traversal language developed by [Apache TinkerPop](https://tinkerpop.apache.org/).

Many graph vendors like [Neo4j](https://neo4j.com/), [Azure Cosmos](https://azure.microsoft.com/services/cosmos-db/), [AWS Neptune](https://aws.amazon.com/neptune/) and [many more](https://tinkerpop.apache.org/#graph-systems) supports Gremlin.

This package provides a basic integration of gremlin for php applications.

This version is built from [TinkerPop v3.6.1](generator/pom.xml#L24).

Installation
------------

[](#installation)

```
composer require specialweb/gremlin-dsl
```

Configuration
-------------

[](#configuration)

This packages provides a static [Configuration](src/Configuration.php) Class with some configuration options.

OptionScopeTypeDefaultDescriptionGREMLIN\_DSL\_REGISTER\_GLOBAL\_FUNCTIONSConstantbooleanfalseGlobally register [short-functions](#short-functions) for gremlin.
E.g. the global `g`-function will be available to start the traversal.enableShortFunctionsConfigurationbooleanfalseGlobally register [short-functions](#short-functions) for gremlin.
E.g. the global `g`-function will be available to start the traversal.sendClosureConfigurationClosurenullRegister a global callback for the [pseudo send step](#sending-the-graph-traversal-string)You can either configure it from array:

```
use SpecialWeb\GremlinDSL\Configuration;

/** @var \Brightzone\GremlinDriver\Connection $connection */
$connection = null;

Configuration::fromConfig([
    'sendClosure' => function (string $traversalString) use ($connection) {
         return $connection->send($traversalString);
     },
    'enableShortFunctions' => true,
]);
```

or set the desired settings directly:

```
use SpecialWeb\GremlinDSL\Configuration;

/** @var \Brightzone\GremlinDriver\Connection $connection */
$connection = null;

Configuration::getInstance()
    ->setSendClosure(function (string $traversalString) use ($connection) {
        return $connection->send($traversalString);
    })
    ->enableShortFunctions()
;
```

Usage
-----

[](#usage)

Just [install the package](#installation) and begin traversing.

```
