Skip to content

Literals

Marijn van Wezel edited this page Dec 12, 2022 · 5 revisions

You can use literals in your Cypher query by using the Query::literal helper method or by using the literal function.

In most cases, PHP literals are automatically converted to Cypher literals. However, sometimes this is not possible, because the type is not supported in PHP (such as Time and Point types). In these cases, the literal needs to be constructed explicitly.

Examples

To use the number 10 in your query:

$ten = literal(10);

To use the string foobar in your query:

$foobar = literal("foobar");

To use double quotes in your string:

$foobar = literal("foobar")->useDoubleQuotes();
Clone this wiki locally