neo4jsymfony6php-8.2

How install neo4j bundle in symfony 6 with php 8.2


I just installed a new symfony project and tried to install the neo4j bundle by doing: composer require neo4j/neo4j-bundle. Here is the error I got:

Cannot use neo4j/neo4j-bundle's latest version 0.4.2 as it requires php ^7.0 which is not satisfied by your platform.

In PackageDiscoveryTrait.php line 317:
   Package neo4j/neo4j-bundle has requirements incompatible with your PHP version, PHP extensions and Composer version:
     - neo4j/neo4j-bundle 0.4.2 requires php ^7.0 which does not match your installed version 8.2.0.

Solution

  • According to GitHub the version 0.4.2 is quite a few years old: https://github.com/neo4j-php/neo4j-symfony/tree/0.4.2 So I guess you must install the bundle in the version dev-master.

    Otherwise directly installing laudis/neo4j-php-client is also possible, though you need to instantiate the connection manually. I've done it this way (and abstracted a few things into their own libs), you can look at my code here: https://github.com/neo4j-php/cypher-entity-manager and https://github.com/ember-nexus/api