|
1 | 1 | # php-cypher-dsl
|
2 | 2 |
|
3 |
| - |
| 3 | + |
4 | 5 |
|
5 |
| -The `php-cypher-dsl` library provides a way to construct advanced Cypher queries in an object-oriented and type-safe manner. |
| 6 | +The `php-cypher-dsl` library provides a way to construct advanced Cypher |
| 7 | +queries in an object-oriented and type-safe manner. |
6 | 8 |
|
7 | 9 | ## Documentation
|
8 | 10 |
|
9 |
| -[The documentation can be found on the wiki here.](https://github.com/WikibaseSolutions/php-cypher-dsl/wiki) |
| 11 | +[The documentation can be found on the wiki |
| 12 | +here.](https://github.com/WikibaseSolutions/php-cypher-dsl/wiki) |
10 | 13 |
|
11 | 14 | ## Installation
|
12 | 15 |
|
13 | 16 | ### Requirements
|
14 | 17 |
|
15 |
| -`php-cypher-dsl` requires PHP 7.4 or greater; using the latest version of PHP is highly recommended. |
| 18 | +`php-cypher-dsl` requires PHP 7.4 or greater; using the latest version of PHP |
| 19 | +is highly recommended. |
16 | 20 |
|
17 | 21 | ### Installation through Composer
|
18 | 22 |
|
19 |
| -You can install `php-cypher-dsl` through composer by running the following command: |
| 23 | +You can install `php-cypher-dsl` through composer by running the following |
| 24 | +command: |
20 | 25 |
|
21 | 26 | ```
|
22 | 27 | composer require "wikibase-solutions/php-cypher-dsl"
|
23 | 28 | ```
|
24 | 29 |
|
25 | 30 | ## Example
|
26 | 31 |
|
27 |
| -To construct a query to find all of Tom Hanks' co-actors, you can use the following code: |
| 32 | +To construct a query to find all of Tom Hanks' co-actors, you can use the |
| 33 | +following code: |
28 | 34 |
|
29 | 35 | ```php
|
30 |
| -$tom = Query::node("Person")->withProperties(["name" => Query::literal("Tom Hanks")]); |
| 36 | +$tom = Query::node("Person")->withProperties(["name" => "Tom Hanks"]); |
31 | 37 | $coActors = Query::node();
|
32 | 38 |
|
33 | 39 | $statement = Query::new()
|
34 | 40 | ->match($tom->relationshipTo(Query::node(), "ACTED_IN")->relationshipFrom($coActors, "ACTED_IN"))
|
35 | 41 | ->returning($coActors->property("name"))
|
36 | 42 | ->build();
|
37 | 43 |
|
38 |
| -$this->assertStringMatchesFormat("MATCH (:Person {name: 'Tom Hanks'})-[:`ACTED_IN`]->()<-[:`ACTED_IN`]-(%s) RETURN %s.name", $statement); |
| 44 | +$this->assertStringMatchesFormat("MATCH (:Person {name: 'Tom Hanks'})-[:ACTED_IN]->()<-[:ACTED_IN]-(%s) RETURN %s.name", $statement); |
39 | 45 | ```
|
0 commit comments