Skip to content

neo4j-php/neo4j-symfony

Repository files navigation

Neo4j Symfony Bundle

Latest Version Build Status Code Coverage Quality Score Total Downloads

Install

Via Composer

$ composer require neo4j/neo4j-bundle

Enable the bundle in your kernel:

<?php
// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Neo4j\Neo4jBundle\Neo4jBundle(),
    );
}

Documentation

The bundle is a convenient way of registering services. We register Connections, Clients and EntityManagers. You will always have alias for the default services:

  • neo4j.driver
  • neo4j.client

Minimal configuration

neo4j:
  drivers:
    default: ~

With the minimal configuration we have services named:

  • neo4j.connection.default
  • neo4j.client.default
  • neo4j.entity_manager.default*

Full configuration example

This example configures the client to contain two instances.

neo4j:
  profiling: true
  default_driver: high-availability
  connections:
    - alias: high-availability
      dsn: 'neo4j://core1.mydomain.com:7687'
      authentication:
        type: 'oidc'
        token: '%neo4j.openconnect-id-token%'
      priority: 1
    # Overriding the alias makes it so that there is a backup server to use in case
    # the routing table cannot be fetched through the driver with a higher priority
    # but the same alias.
    # Once the table is fetched it will use that information to auto-route as usual.
    - alias: high-availability
      dsn: 'neo4j://core2.mydomain.com:7687'
      priority: 0
      authentication:
        type: 'oidc'
        token: '%neo4j.openconnect-id-token%'
    - alias: backup-instance
      dsn: 'bolt://localhost:7687'
      authentication:
        type: basic
        username: '%neo4j.backup-user%'
        password: '%neo4j.backup-pass%'

Testing

$ composer test

Example application

See an example application at https://github.com/neo4j-examples/movies-symfony-php-bolt (legacy project)

License

The MIT License (MIT). Please see License File for more information.

About

Symfony Bundle for the Neo4j Graph Database

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 16

Languages