innmind / neo4j-dbal
This package is abandoned and no longer maintained.
No replacement package was suggested.
Abstraction layer of the Neo4j http API
6.1.0
2021-02-14 10:05 UTC
Requires
- php: ~7.4|~8.0
- innmind/immutable: ~3.5
- innmind/json: ^1.1
- innmind/operating-system: ~2.0
- psr/log: ^1.0
Requires (Dev)
- innmind/black-box: ^4.16
- innmind/cli: ~2.0
- innmind/coding-standard: ^1.1
- innmind/object-graph: ~2.0
- phpunit/phpunit: ~9.0
- vimeo/psalm: ~4.4
README
PHP abstraction layer for neo4j graph database
Installation
Run the following command in your project to add this library:
composer require innmind/neo4j-dbal
Documentation
Basic example to run a query:
use function Innmind\Neo4j\DBAL\bootstrap; use Innmind\Neo4j\DBAL\{ Query, Clause\Expression\Relationship }; use Innmind\OperatingSystem\Factory; $os = Factory::build(); $connection = bootstrap( $os->remote()->http(), $os->clock(), ); $query = (new Query) ->match('n', ['LabelA', 'LabelB']) ->withProperty('foo', '$param') ->withParameter('param', 'value') ->linkedTo('n2') ->through('r', 'REL_TYPE', 'right') ->return('n', 'n2', 'r'); echo $query->cypher(); //MATCH (n:LabelA:LabelB { foo: $param })-[r:REL_TYPE]->(n2) RETURN n, n2, r $result = $connection->execute($query); echo $result->nodes()->count(); //2 echo $result->relationships()->count(); //1
Note: Each object in this library is immutable, so $query->match('n')->match('n2')
is different than $query->match('n'); $query->match('n2')
.
Querying
You have 3 options to execute a query:
- use
Query
to build the query via its API - use
Cypher
where you put the raw cypher query - create your own class that implements
Query