GraphAware\Neo4j\Client\HttpDriver\GraphDatabase::driver PHP Method

driver() public static method

public static driver ( string $uri, GraphAware\Common\Driver\ConfigInterface $config = null ) : Driver
$uri string
$config GraphAware\Common\Driver\ConfigInterface
return Driver
    public static function driver($uri, ConfigInterface $config = null)
    {
        return new Driver($uri, $config);
    }

Usage Example

 private function buildDriver()
 {
     $params = parse_url($this->uri);
     if (preg_match('/bolt/', $this->uri)) {
         $port = isset($params['port']) ? (int) $params['port'] : BoltDriver::DEFAULT_TCP_PORT;
         $uri = sprintf('%s://%s:%d', $params['scheme'], $params['host'], $port);
         $config = null;
         if (isset($params['user']) && isset($params['pass'])) {
             $config = Configuration::newInstance()->withCredentials($params['user'], $params['pass']);
         }
         $this->driver = BoltGraphDB::driver($uri, $config);
     } elseif (preg_match('/http/', $this->uri)) {
         $uri = $this->uri;
         $this->driver = HttpGraphDB::driver($uri, $this->config);
     } else {
         throw new \RuntimeException(sprintf('Unable to build a driver from uri "%s"', $this->uri));
     }
 }
GraphDatabase