https://github.com/neo4j-php/neo4j-symfony
Symfony Bundle for the Neo4j Graph Database
https://github.com/neo4j-php/neo4j-symfony
bundle graph-database neo4j php symfony symfony-bundle
Last synced: about 1 year ago
JSON representation
Symfony Bundle for the Neo4j Graph Database
- Host: GitHub
- URL: https://github.com/neo4j-php/neo4j-symfony
- Owner: neo4j-php
- License: mit
- Created: 2016-12-07T10:46:08.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2025-03-10T08:00:22.000Z (over 1 year ago)
- Last Synced: 2025-04-08T14:13:04.404Z (over 1 year ago)
- Topics: bundle, graph-database, neo4j, php, symfony, symfony-bundle
- Language: PHP
- Size: 280 KB
- Stars: 80
- Watchers: 14
- Forks: 43
- Open Issues: 14
-
Metadata Files:
- Readme: docs/README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# Neo4j Symfony Bundle
[](https://github.com/neo4j-contrib/neo4j-symfony/releases)
[](https://travis-ci.org/neo4j-contrib/neo4j-symfony)
[](https://scrutinizer-ci.com/g/neo4j-contrib/neo4j-symfony)
[](https://scrutinizer-ci.com/g/neo4j-contrib/neo4j-symfony)
[](https://packagist.org/packages/neo4j/neo4j-bundle)
Installation
============
Make sure Composer is installed globally, as explained in the
[installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.
Applications that don't use Symfony Flex
----------------------------------------
### Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:
```console
$ composer require neo4j/neo4j-bundle
```
### Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:
```php
// config/bundles.php
return [
// ...
\Neo4j\Neo4jBundle\Neo4jBundle::class => ['all' => true],
];
```
## Documentation
The bundle is a convenient way of registering services. We register `Drivers` and one
`Clients`. You will always have alias for the default services:
* neo4j.driver
* neo4j.client
### Minimal configuration
```yaml
neo4j:
drivers:
default: ~
```
With the minimal configuration we have services named:
* neo4j.driver.default
* neo4j.client
### Full configuration example
This example configures the client to contain two instances.
```yaml
neo4j:
profiling: true
default_driver: high-availability
drivers:
- 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
``` bash
$ 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](../LICENSE) for more information.