Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stefanak-michal/neo4j-bolt-wrapper
Wrapper for Neo4j over PHP Bolt library to simplify usage.
https://github.com/stefanak-michal/neo4j-bolt-wrapper
bolt driver graph-database neo4j php
Last synced: 9 days ago
JSON representation
Wrapper for Neo4j over PHP Bolt library to simplify usage.
- Host: GitHub
- URL: https://github.com/stefanak-michal/neo4j-bolt-wrapper
- Owner: stefanak-michal
- License: mit
- Created: 2022-07-19T08:13:31.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-13T14:09:23.000Z (over 1 year ago)
- Last Synced: 2024-05-02T05:22:34.973Z (7 months ago)
- Topics: bolt, driver, graph-database, neo4j, php
- Language: PHP
- Homepage:
- Size: 14.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Neo4j Bolt wrapper
This library contains wrapper class to cover basic functionality with [Bolt library](https://github.com/neo4j-php/Bolt).
## Instalation
Run the following command in your project to install the latest applicable version of the package:
`composer require stefanak-michal/neo4j-bolt-wrapper`
[Packagist](https://packagist.org/packages/stefanak-michal/neo4j-bolt-wrapper)
## Usage
```php
Neo4j::$auth = \Bolt\helpers\Auth::basic('username', 'password');
$rows = Neo4j::query('RETURN $n as num', ['n' => 123]);
```You can also use methods like `queryFirstField` and `queryFirstColumn`.
_If you want to learn more about available query parameters check Bolt library [readme](https://github.com/neo4j-php/Bolt/blob/master/README.md)._
### Database server
Default connection is executed on 127.0.0.1:7687. You can change target server with static properties:
```php
Neo4j::$host = 'neo4j+s://demo.neo4jlabs.com';
Neo4j::$port = 7687;
```### Transactions
Transaction methods are:
```php
Neo4j::begin();
Neo4j::commit();
Neo4j::rollback();
```### Log handler
You can set callable function into `Neo4j::$logHandler` which is called everytime query is executed. Method will receive executed query with additional statistics.
_Check class property annotation for more information._
### Error handler
Standard behaviour on error is trigger_error with E_USER_ERROR. If you want to handle Exception by yourself you can set callable function into `Neo4j::$errorHandler`.
### Statistics
Wrapper offers special method `Neo4j::statistic()`. This method returns specific information from last executed query.
_Check method annotation for more information._
## Support