Skip to content

Commit 94e3277

Browse files
Update README.md
1 parent 24f5955 commit 94e3277

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,21 @@ extensions:
2626
## Usage
2727
See ``index.php`` file. It contains few examples how you can use this library. Of course you need to set up your username and password. This repository contains simple `autoload.php` file.
2828

29+
### Main code example
30+
```php
31+
<?php
32+
//Create new Bolt instance
33+
$neo4j = new \Bolt\Bolt();
34+
//Set Bolt protocol version (default is newest 4.1)
35+
$neo4j->setProtocolVersions(4.1);
36+
//Connect to database
37+
$neo4j->init('MyClient/1.0', 'username', 'password);
38+
//Execute query
39+
$neo4j->run('RETURN 1 AS num, 2 AS cnt');
40+
//Pull records from last query
41+
$rows = $neo4j->pull();
42+
```
43+
2944
## Exceptions
3045
Throwing exceptions is default behaviour. If you want, you can assign own callable error handler to ``\Bolt\Bolt::$errorHandler``. It's called on error and methods (init, run, pullAll, ...) will therefore return false.
3146

0 commit comments

Comments
 (0)