niterain/neo4j-php-ogm

Brings Neo4J PHP OGM to Laravel4

dev-master 2013-12-12 14:35 UTC

This package is not auto-updated.

Last update: 2024-11-19 02:30:26 UTC


README

Allows you to use Neo4j with Laravel4

Installation

Add niterain\Neo4jPhpOgm as a requirement to composer.json:

{
    "require": {
        "niterain/neo4j-php-ogm": "dev-master"
    }
}

Update your packages with composer update or install with composer install.

Once Composer has installed or updated your packages you need to register Neo4jPhpOgm with Laravel. Open up app/config/app.php and find the providers key towards the bottom and add:

'Niterain\Neo4jPhpOgm\Neo4jPhpOgmServiceProvider',

Configuration

Since I like having my config files in one directory, this library checks to see if the settings are in the database.php file in the app/config directory as one of the connections under the 'neo4j' key, but if there isn't one defined, it looks in its local config.php file.

Usage

You add your entities in an Entity folder, from there everything feels much like Doctrine2.

$em = App::make('entityManager');
$user = $em->getRepository('Entity\\User');
$user->add(array('firstName' => 'levi', 'lastName' => 'stanley'));
$em->persist($user);
$em->flush();