You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bolt protocol library over TCP socket. Bolt protocol is primary used for communication with [Neo4j](https://neo4j.com/) Graph database. The documentation is available at [https://7687.org/](https://7687.org/).
Run the following command to install the latest applicable version of the package:
28
-
29
-
``composer require stefanak-michal/bolt``
30
-
31
-
## Usage
32
-
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.
33
-
34
-
### Main code example
35
-
```php
36
-
<?php
37
-
//Create new Bolt instance
38
-
$bolt = new \Bolt\Bolt();
39
-
//Set Bolt protocol version (default is newest 4.1)
| setProtocolVersions | set requested protocol versions |
52
-
| getProtocolVersion | get used protocol version (you have to establish connection with init() method first) |
53
-
| init | connect to database |
54
-
| run | execute query |
55
-
| pull / pullAll | fetch records from last query |
56
-
| discard / discardAll | discard records from last query |
57
-
| begin | start transaction |
58
-
| commit | commit transaction |
59
-
| rollback | rollback transaction |
60
-
| reset | reset connection |
61
-
62
-
## Exceptions
63
-
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.
I really like Neo4j and I wanted to use it with PHP. But after I looked on official php library, I was really disappointed. Too much dependencies. I don't like if I need to install 10 things because of one. First I decided to use HTTP API for communication, but it wasn't fast enough. I went through bolt protocol documentation and I said to myself, why not to create own simpler library?
0 commit comments