Skip to content

Commit a03c150

Browse files
Added badges, moved informations to wiki
1 parent 787d9a2 commit a03c150

File tree

1 file changed

+8
-44
lines changed

1 file changed

+8
-44
lines changed

README.md

Lines changed: 8 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Bolt
22
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/).
33

4+
![](https://img.shields.io/badge/phpunit-passed-success) ![](https://img.shields.io/badge/coverage-70%25-yellowgreen) ![](https://img.shields.io/github/stars/stefanak-michal/Bolt) ![](https://img.shields.io/packagist/dt/stefanak-michal/bolt) ![](https://img.shields.io/github/v/release/stefanak-michal/bolt) ![](https://img.shields.io/github/commits-since/stefanak-michal/bolt/latest)
5+
46
## Supported version
57
Bolt <= 4.1
68

@@ -17,53 +19,15 @@ Bolt <= 4.1
1719

1820
<sup>The (x) denotes that support could be removed in next version of Neo4j.</sup>
1921

20-
## Requirements
21-
PHP >= 7.1
22-
extensions:
23-
- sockets https://www.php.net/manual/en/book.sockets.php
24-
- mbstring https://www.php.net/manual/en/book.mbstring.php
25-
26-
## Installation via composer
27-
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)
40-
$bolt->setProtocolVersions(4.1);
41-
//Connect to database
42-
$bolt->init('MyClient/1.0', 'username', 'password');
43-
//Execute query
44-
$bolt->run('RETURN 1 AS num, 2 AS cnt');
45-
//Pull records from last query
46-
$rows = $bolt->pull();
47-
```
48-
49-
| Method | Description |
50-
|--------------------------|---------------------------------------------------------------------------------------|
51-
| 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.
22+
## [Requirements](https://github.com/stefanak-michal/Bolt/wiki/Requirements)
23+
## [Installation](https://github.com/stefanak-michal/Bolt/wiki/Installation)
24+
## [Usage](https://github.com/stefanak-michal/Bolt/wiki/Usage)
25+
## [Errors](https://github.com/stefanak-michal/Bolt/wiki/Errors)
6426

6527
## Author note
6628
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?
6729

30+
[Speed comparison](https://github.com/stefanak-michal/Bolt/wiki/Speed-comparison)
31+
6832
## Another solutions
6933
https://neo4j.com/developer/php/

0 commit comments

Comments
 (0)