wikibase-solutions / php-cypher-dsl
A query builder for the Cypher query language
7.0.0
2026-02-07 16:17 UTC
Requires
- php: >=8.1
- ext-ctype: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- infection/infection: ^0.29
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.0
- rregeer/phpunit-coverage-check: ^0.3.1
This package is auto-updated.
Last update: 2026-03-07 16:27:12 UTC
README
The php-cypher-dsl library provides a way to construct Cypher queries in a type-safe manner.
Documentation
The documentation can be found on the wiki here.
Installation
Requirements
php-cypher-dsl requires PHP 8.1 or greater; using the latest version of PHP is highly recommended.
Installation through Composer
You can install php-cypher-dsl through Composer by running the following command:
composer require "wikibase-solutions/php-cypher-dsl"
Contributing
Please refer to CONTRIBUTING.md for information on how to contribute to this project.
Example
To construct a query to find all of Tom Hanks' co-actors, you can use the following code:
use function WikibaseSolutions\CypherDSL\node; use function WikibaseSolutions\CypherDSL\query; $tom = node("Person")->withProperties(["name" => "Tom Hanks"]); $coActors = node(); $statement = query() ->match($tom->relationshipTo(node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN")) ->returning($coActors->property("name")) ->build();
This produces the following Cypher query (where $1 is a random variable name):
MATCH (:Person {name: 'Tom Hanks'})-[:ACTED_IN]->()<-[:ACTED_IN]-($1) RETURN $1.name