{"__v":1,"_id":"57d6af688bd2f30e004aeaec","category":{"__v":0,"_id":"57d6ada046dcc30e007dd15e","project":"566c97797831040d003eb3bc","version":"566c97797831040d003eb3bf","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-09-12T13:29:04.136Z","from_sync":false,"order":8,"slug":"drivers-and-languages","title":"Language center"},"parentDoc":null,"project":"566c97797831040d003eb3bc","user":"5716283e40ef9c2000cac92a","version":{"__v":10,"_id":"566c97797831040d003eb3bf","project":"566c97797831040d003eb3bc","createdAt":"2015-12-12T21:54:01.970Z","releaseDate":"2015-12-12T21:54:01.970Z","categories":["566c977a7831040d003eb3c0","5716338cb5af590e00a0ff1d","57163947893cbe0e002d75fc","57163f41b5af590e00a0ff35","57cd74d2873de50e00724a2f","57cd7de8baaee30e0093ecc3","57d6ada046dcc30e007dd15e","57fdc2b31646dc0e0010480a","57fdd8b86c9d141900d87bf1","58767da4d89ef20f003b6f1e"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.0.0","version":"1.0"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-09-12T13:36:40.919Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":4,"body":"If PHP is your language of choice, the most popular driver for Neo4j is:\n\n* [GraphAware Neo4j PHP client](#section-graphaware-neo4j-php-client) [community driver]\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"About connection parameters\",\n  \"body\": \"We've used test credentials for all the following examples. Please replace them with your real connection parameters.\\n\\nYou'll find all the required information to connect to your database on our admin panel if you navigate to the Connection section. More on connecting to your database [here](docs:connecting-to-your-database).\"\n}\n[/block]\n## GraphAware Neo4j PHP Client\n\nNeo4j-PHP-Client is an advanced and flexible Neo4j Client for PHP.\n\nThis client is only compatible with 2.2.6 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database.\n\nDriver page: https://github.com/graphaware/neo4j-php-client\n\nTo install the client, add the library to your composer dependencies :\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"composer require graphaware/neo4j-php-client:^4.6\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nThen just require the composer autoloader, configure your connection by providing a connection alias and your connection settings:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\nrequire_once __DIR__ .'/vendor/autoload.php';\\nuse GraphAware\\\\Neo4j\\\\Client\\\\ClientBuilder;\\n\\n$client = ClientBuilder::create()\\n    ->addConnection('default', 'http://v303:GtGq5rldxu:::at:::hobby-geefdaeefcom.dbs.graphenedb.com:24789')\\n    ->build();\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nIf you prefer to use **Bolt**:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<?php\\nrequire_once __DIR__ .'/vendor/autoload.php';\\nuse GraphAware\\\\Neo4j\\\\Client\\\\ClientBuilder;\\n\\n// Example for Bolt\\n$config = \\\\GraphAware\\\\Bolt\\\\Configuration::newInstance()\\n->withCredentials('v303', 'GtGq5rldxu')\\n->withTimeout(10)\\n->withTLSMode(\\\\GraphAware\\\\Bolt\\\\Configuration::TLSMODE_REQUIRED);\\n\\n$driver = \\\\GraphAware\\\\Bolt\\\\GraphDatabase::driver('bolt://hobby-geefdaeefcom.dbs.graphenedb.com:24786', $config);\\n$client = $driver->session();\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]\nTest the connection by creating a dummy node:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$result = $client->run(\\\"CREATE (n:Person {name: ‘Bob’}) RETURN id(n)\\\");\\necho $result->getRecord()->value(\\\"id(n)\\\");\",\n      \"language\": \"php\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"php","type":"basic","title":"PHP"}
If PHP is your language of choice, the most popular driver for Neo4j is: * [GraphAware Neo4j PHP client](#section-graphaware-neo4j-php-client) [community driver] [block:callout] { "type": "info", "title": "About connection parameters", "body": "We've used test credentials for all the following examples. Please replace them with your real connection parameters.\n\nYou'll find all the required information to connect to your database on our admin panel if you navigate to the Connection section. More on connecting to your database [here](docs:connecting-to-your-database)." } [/block] ## GraphAware Neo4j PHP Client Neo4j-PHP-Client is an advanced and flexible Neo4j Client for PHP. This client is only compatible with 2.2.6 or higher versions of Neo4j. You can check your Neo4j version if you navigate to the Overview page of your database. Driver page: https://github.com/graphaware/neo4j-php-client To install the client, add the library to your composer dependencies : [block:code] { "codes": [ { "code": "composer require graphaware/neo4j-php-client:^4.6", "language": "shell" } ] } [/block] Then just require the composer autoloader, configure your connection by providing a connection alias and your connection settings: [block:code] { "codes": [ { "code": "<?php\nrequire_once __DIR__ .'/vendor/autoload.php';\nuse GraphAware\\Neo4j\\Client\\ClientBuilder;\n\n$client = ClientBuilder::create()\n ->addConnection('default', 'http://v303:GtGq5rldxu@hobby-geefdaeefcom.dbs.graphenedb.com:24789')\n ->build();", "language": "php" } ] } [/block] If you prefer to use **Bolt**: [block:code] { "codes": [ { "code": "<?php\nrequire_once __DIR__ .'/vendor/autoload.php';\nuse GraphAware\\Neo4j\\Client\\ClientBuilder;\n\n// Example for Bolt\n$config = \\GraphAware\\Bolt\\Configuration::newInstance()\n->withCredentials('v303', 'GtGq5rldxu')\n->withTimeout(10)\n->withTLSMode(\\GraphAware\\Bolt\\Configuration::TLSMODE_REQUIRED);\n\n$driver = \\GraphAware\\Bolt\\GraphDatabase::driver('bolt://hobby-geefdaeefcom.dbs.graphenedb.com:24786', $config);\n$client = $driver->session();", "language": "php" } ] } [/block] Test the connection by creating a dummy node: [block:code] { "codes": [ { "code": "$result = $client->run(\"CREATE (n:Person {name: ‘Bob’}) RETURN id(n)\");\necho $result->getRecord()->value(\"id(n)\");", "language": "php" } ] } [/block]