PHPackages                             digitalcloud/neo-eloquent - 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. digitalcloud/neo-eloquent

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

digitalcloud/neo-eloquent
=========================

Laravel wrapper for the Neo4j graph database REST interface

0.2(7y ago)1211MITPHPPHP &gt;=7.1.3CI failing

Since Apr 22Pushed 7y ago2 watchersCompare

[ Source](https://github.com/DigitalCloud/neo-eloquent)[ Packagist](https://packagist.org/packages/digitalcloud/neo-eloquent)[ RSS](/packages/digitalcloud-neo-eloquent/feed)WikiDiscussions master Synced today

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

[![SensioLabsInsight](https://camo.githubusercontent.com/9a01127f45e73b2f599133bc41d8c0474b6ac5159eee1b35e44099a11e83caa9/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34366436333266382d366233632d343434362d613264342d6332323762613463663337332f6269672e706e67)](https://insight.sensiolabs.com/projects/46d632f8-6b3c-4446-a2d4-c227ba4cf373)

[![Build Status](https://camo.githubusercontent.com/780719514804f6a76404294c889137339d2c72bcbb0d2e8665d59c6cccb1fab6/68747470733a2f2f7472617669732d63692e6f72672f56696e656c61622f4e656f456c6f7175656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Vinelab/NeoEloquent)

NeoEloquent
===========

[](#neoeloquent)

Neo4j Graph Eloquent Driver for Laravel

Chat &amp; Support
------------------

[](#chat--support)

Join the [Official Neo4j Slack Group](https://neo4j.com/blog/public-neo4j-users-slack-group/) and use the #neo4j-php channel.

Quick Reference
---------------

[](#quick-reference)

- [Installation](#installation)
- [Configuration](#configuration)
- [Models](#models)
- [Relationships](#relationships)
- [Edges](#edges)
- [Migration](#migration)
- [Schema](#schema)
- [Aggregates](#aggregates)
- [Only in Neo](#only-in-neo)
- [Things To Avoid](#avoid)

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

[](#installation)

Add the package to your `composer.json` and run `composer update`.

### Laravel 5

[](#laravel-5)

#### 5.6

[](#56)

```
{
    "require": {
        "vinelab/neoeloquent": "^1.4.6"
    }
}
```

#### 5.5

[](#55)

```
{
    "require": {
        "vinelab/neoeloquent": "^1.4.5"
    }
}
```

#### 5.4

[](#54)

```
{
    "require": {
        "vinelab/neoeloquent": "1.4.3"
    }
}
```

#### 5.3

[](#53)

```
{
    "require": {
        "vinelab/neoeloquent": "1.4.2"
    }
}
```

#### 5.2

[](#52)

```
{
    "require": {
        "vinelab/neoeloquent": "1.3.*"
    }
}
```

#### 5.1

[](#51)

```
{
    "require": {
        "vinelab/neoeloquent": "1.2.*"
    }
}
```

#### 5.0

[](#50)

```
{
    "require": {
        "vinelab/neoeloquent": "1.2.5"
    }
}
```

### Laravel 4

[](#laravel-4)

```
{
    "require": {
        "vinelab/neoeloquent": "1.1.*"
    }
}
```

Add the service provider in `app/config/app.php`:

```
'Vinelab\NeoEloquent\NeoEloquentServiceProvider',
```

The service provider will register all the required classes for this package and will also alias the `Model` class to `NeoEloquent` so you can simply `extend NeoEloquent` in your models.

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

[](#configuration)

### Connection

[](#connection)

in `app/config/database.php` or in case of an environment-based configuration `app/config/[env]/database.php`make `neo4j` your default connection:

```
'default' => 'neo4j',
```

Add the connection defaults:

```
'connections' => [
    'neo4j' => [
        'driver' => 'neo4j',
        'host'   => env('DB_HOST', 'localhost'),
        'port'   => env('DB_PORT', '7474'),
        'username' => env('DB_USERNAME', null),
        'password' => env('DB_PASSWORD', null)
    ]
]
```

### Lumen

[](#lumen)

For Lumen you need to create a new folder called `config` in the application root and there add a file called `database.php`. There you will add the following code.

```
