11# php-cypher-dsl
22
3- The ` php-cypher-dsl ` library provides a way to construct advanced Cypher
4- queries in an object-oriented and type-safe manner.
3+ The ` php-cypher-dsl ` library provides a way to construct Cypher queries in a type-safe manner.
54
65## Documentation
76
8- [ The documentation can be found on the wiki
9- here.] ( https://github.com/WikibaseSolutions/php-cypher-dsl/wiki )
7+ [ The documentation can be found on the wiki here.] ( https://github.com/WikibaseSolutions/php-cypher-dsl/wiki )
108
119## Installation
1210
1311### Requirements
1412
15- ` php-cypher-dsl ` requires PHP 7.4 or greater; using the latest version of PHP
16- is highly recommended.
13+ ` php-cypher-dsl ` requires PHP 8.1 or greater; using the latest version of PHP is highly recommended.
1714
1815### Installation through Composer
1916
20- You can install ` php-cypher-dsl ` through composer by running the following
21- command:
17+ You can install ` php-cypher-dsl ` through Composer by running the following command:
2218
2319```
2420composer require "wikibase-solutions/php-cypher-dsl"
@@ -30,8 +26,7 @@ Please refer to [CONTRIBUTING.md](https://github.com/neo4j-php/php-cypher-dsl/bl
3026
3127## Example
3228
33- To construct a query to find all of Tom Hanks' co-actors, you can use the
34- following code:
29+ To construct a query to find all of Tom Hanks' co-actors, you can use the following code:
3530
3631``` php
3732use function WikibaseSolutions\CypherDSL\node;
@@ -41,7 +36,13 @@ $tom = node("Person")->withProperties(["name" => "Tom Hanks"]);
4136$coActors = node();
4237
4338$statement = query()
44- ->match($tom->relationshipTo(Query:: node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN"))
39+ ->match($tom->relationshipTo(node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN"))
4540 ->returning($coActors->property("name"))
4641 ->build();
4742```
43+
44+ This produces the following Cypher query (where ` $1 ` is a random variable name):
45+
46+ ```
47+ MATCH (:Person {name: 'Tom Hanks'})-[:ACTED_IN]->()<-[:ACTED_IN]-($1) RETURN $1.name
48+ ```
0 commit comments