PHPackages                             mcuadros/php-cayley - 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. [Database &amp; ORM](/categories/database)
4. /
5. mcuadros/php-cayley

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

mcuadros/php-cayley
===================

PHP Wrapper for the Google's Cayley graph database REST interface.

16522[1 issues](https://github.com/mcuadros/php-cayley/issues)PHP

Since Apr 12Pushed 10y ago4 watchersCompare

[ Source](https://github.com/mcuadros/php-cayley)[ Packagist](https://packagist.org/packages/mcuadros/php-cayley)[ RSS](/packages/mcuadros-php-cayley/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

php-cayley [![Build Status](https://camo.githubusercontent.com/722b3a1424d360de36797c11ec47a57b0920ede108655ed75133d6e27ac8462c/68747470733a2f2f7472617669732d63692e6f72672f6d63756164726f732f7068702d6361796c65792e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/mcuadros/php-cayley)
===================================================================================================================================================================================================================================================================================================

[](#php-cayley-)

PHP Wrapper for the [Google's Cayley](https://github.com/google/cayley) graph database REST interface.

> Cayley is an open-source graph inspired by the graph database behind [Freebase](http://freebase.com/) and Google's [Knowledge Graph](http://www.google.com/insidesearch/features/search/knowledge.html). Its goal is to be a part of the developer's toolbox where [Linked Data](http://linkeddata.org/) and graph-shaped data (semantic webs, social networks, etc) in general are concerned.

The Cayley's default query language is called [Gremlin](http://gremlindocs.com/) based on JavaScript. php-cayley is a replica of this [Gremlin Javascript API](https://github.com/google/cayley/blob/master/docs/GremlinAPI.md) in PHP, all the methods and patterns from Gremlin are applicable to this library.

Requirements
------------

[](#requirements)

- php &gt;=5.5.0
- guzzlehttp/guzzle ~6.0

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

[](#installation)

The recommended way to install php-cayley is [through composer](http://getcomposer.org). You can see [the package information on Packagist.](https://packagist.org/packages/mcuadros/php-cayley)

```
{
    "require": {
        "mcuadros/php-cayley": "dev-master"
    }
}
```

Usage
-----

[](#usage)

### Basic example

[](#basic-example)

```
$cayley = new Cayley\Client();
$query = $cayley->graph()->vertex('Humphrey Bogart')->all();
$result = $cayley->query($query);
print_r($result);
```

### Morphism example

[](#morphism-example)

```
$cayley = new Cayley\Client();

$filmToActor = $cayley->graph()
    ->morphism()
    ->out('/film/film/starring')
    ->out('/film/performance/actor');

$query = $cayley->graph()
    ->vertex()
    ->has('name', 'Casablanca')
    ->follow($filmToActor)
    ->out('name')
    ->all();

$starring = $cayley->query($query);
foreach($starring as $actor) {
    var_dump($actor['id']);
}
```

These examples are based on the data contained in the example database `30kmoviedata.nq.gz`

For more information please read [Gremlin Javascript API](https://github.com/google/cayley/blob/master/docs/GremlinAPI.md) documentation.

Tests
-----

[](#tests)

Tests are in the `tests` folder. To run them, you need PHPUnit. Example:

```
$ phpunit --configuration phpunit.xml.dist

```

License
-------

[](#license)

MIT, see [LICENSE](LICENSE)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

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/2731762b7c1dc9e30dbd878c0f03cb99410ad894a6996f98d132047f8885d00d?d=identicon)[mcuadros](/maintainers/mcuadros)

---

Top Contributors

[![mcuadros](https://avatars.githubusercontent.com/u/1573114?v=4)](https://github.com/mcuadros "mcuadros (18 commits)")

### Embed Badge

![Health badge](/badges/mcuadros-php-cayley/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M545](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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