<commit_before># GrapheneDB Client for PHP 5.4+

![img](http://www.graphenedb.com/images/logo.png)

A PHP Client for the popular [GrapheneDB](http://www.graphenedb.com) | Neo4j as a Service.

### Requirements

* A GrapheneDB account, you can create one here : https://app.graphenedb.com/signup

### Usage

Require the library with composer :

```bash
composer require neoxygen/graphenedb-client
```

Create the client by providing your GrapheneDB account e-mail and password :

```php

require_once 'vendor/autoload.php';

use Neoxygen\GrapheneDBClient\GrapheneDBClient;

$client = new GrapheneDBClient('<EMAIL>', '<PASSWORD>');
```

#### Create a Neo4j database instance

You need to pass a name for your database, and optionally a neo4j version :

```php
$myNewDB = $client->createDatabase('test');
```

By default, the latest neo4j version will be used (currently 2.1.5)

This will return you a `Neoxygen\GrapheneDBClient\Database` instance, for the available methods of this class read the section `The Database class`.

#### Listing available versions :

```php
$client->getVersions();
```

```
Array
(
    [default] => v215
    [versions] => Array
        (
            [0] => Array
                (
                    [version] => v198
                    [label] => Neo4j Community Edition 1.9.8
                )

            [1] => Array
                (
                    [version] => v204
                    [label] => Neo4j Community Edition 2.0.4
                )

            [2] => Array
                (
                    [version] => v215
                    [label] => Neo4j Community Edition 2.1.5
                )

        )

)
```

#### Getting all your databases

```php
$databases = $client->getDatabases();
```

This will return you a collection of `Neoxygen\GrapheneDBClient\Database` instances.

#### Getting a specific database

You need to provide the name of your database :

```php
$db = $client->getDatabase('test');
```

This will return you an instance of `Neoxygen\GrapheneDBClient\Database`.

#### Deleting a database

You need to provide the name of the database you want to delete :

```php
$client->deleteDatabase('test');
```

This will return you true, or throw an exception if the database does not exist.

#### Deleting all databases

```php<commit_msg>fixed bad doc for deleteDatabase<commit_after># GrapheneDB Client for PHP 5.4+

![img](http://www.graphenedb.com/images/logo.png)

A PHP Client for the popular [GrapheneDB](http://www.graphenedb.com) | Neo4j as a Service.

### Requirements

* A GrapheneDB account, you can create one here : https://app.graphenedb.com/signup

### Usage

Require the library with composer :

```bash
composer require neoxygen/graphenedb-client
```

Create the client by providing your GrapheneDB account e-mail and password :

```php

require_once 'vendor/autoload.php';

use Neoxygen\GrapheneDBClient\GrapheneDBClient;

$client = new GrapheneDBClient('<EMAIL>', 'SuPeRp@sSwOrD');
```

#### Create a Neo4j database instance

You need to pass a name for your database, and optionally a neo4j version :

```php
$myNewDB = $client->createDatabase('test');
```

By default, the latest neo4j version will be used (currently 2.1.5)

This will return you a `Neoxygen\GrapheneDBClient\Database` instance, for the available methods of this class read the section `The Database class`.

#### Listing available versions :

```php
$client->getVersions();
```

```
Array
(
    [default] => v215
    [versions] => Array
        (
            [0] => Array
                (
                    [version] => v198
                    [label] => Neo4j Community Edition 1.9.8
                )

            [1] => Array
                (
                    [version] => v204
                    [label] => Neo4j Community Edition 2.0.4
                )

            [2] => Array
                (
                    [version] => v215
                    [label] => Neo4j Community Edition 2.1.5
                )

        )

)
```

#### Getting all your databases

```php
$databases = $client->getDatabases();
```

This will return you a collection of `Neoxygen\GrapheneDBClient\Database` instances.

#### Getting a specific database

You need to provide the name of your database :

```php
$db = $client->getDatabase('test');
```

This will return you an instance of `Neoxygen\GrapheneDBClient\Database`.

#### Deleting a database

You need to provide the `id` of the database you want to delete :

```php
$db = $client->getDatabase('test');
$client->deleteDatabase($db->getId());
```

This will return you true, or throw an exception if the database does not exist.

#### Deleting all databases

```php
{'fraction_non_alphanumeric': 0.12227447627191107, 'fraction_numerical': 0.015391192817443352, 'mean_word_length': 2.6497659906396254, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 40, 'https://': 2, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5945598', 'n_tokens_mistral': 1518, 'n_tokens_neox': 1372, 'n_words': 455}