PHPackages                             stefanak-michal/pdo-bolt - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. stefanak-michal/pdo-bolt

ActiveLibrary[Database &amp; ORM](/categories/database)

stefanak-michal/pdo-bolt
========================

PDO for Bolt protocol

v1.1(3y ago)23[2 issues](https://github.com/stefanak-michal/pdo-bolt/issues)MITPHPPHP ^8.0

Since Dec 15Pushed 3y ago1 watchersCompare

[ Source](https://github.com/stefanak-michal/pdo-bolt)[ Packagist](https://packagist.org/packages/stefanak-michal/pdo-bolt)[ Docs](https://github.com/stefanak-michal/pdo-bolt)[ GitHub Sponsors](https://github.com/sponsors/stefanak-michal)[ Fund](https://ko-fi.com/michalstefanak)[ RSS](/packages/stefanak-michal-pdo-bolt/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

PDO bolt
========

[](#pdo-bolt)

The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. This library is dedicated to add bolt protocol. This protocol was created by [Neo4j](https://neo4j.com/) and is used by graph databases like Neo4j, Memgraph or Amazon Neptune.

Right now there is no official C/C++ bolt driver and therefore it is not possible to make this library as extension. Even the unofficial driver looks like it is not maintained. Maybe in future it will change but before that you are welcomed to use this one.

[Bolt specification](https://neo4j.com/docs/bolt/current/)

[![Buy Me a Coffee at ko-fi.com](https://camo.githubusercontent.com/543e9e0b586eec325bcc5f1bcd0186f9d7e7523b4c921a385aa6f4ade9c20b3b/68747470733a2f2f63646e2e6b6f2d66692e636f6d2f63646e2f6b6f6669312e706e673f763d33)](https://ko-fi.com/Z8Z5ABMLW)

Requirements
------------

[](#requirements)

- PHP ^8
- [Bolt library](https://packagist.org/packages/stefanak-michal/bolt)

Installation
------------

[](#installation)

You can use composer or download this repository from GitHub and manually implement it.

### Composer

[](#composer)

Run the following command in your project to install the latest applicable version of the package:

`composer require stefanak-michal/pdo-bolt`

[Packagist](https://packagist.org/packages/stefanak-michal/pdo-bolt)

Usage
-----

[](#usage)

You can use this library as typical PDO, but you have to create instance of `\pdo_bolt\PDO` which overrides `\PDO` and adds bolt scheme.

```
$pdo = new \pdo_bolt\PDO('bolt:host=localhost;port=7687;appname=pdo-bolt', 'neo4j', 'neo4j');
$stmt = $pdo->prepare('RETURN $n AS num, $s AS str');
$stmt->bindValue('n', 123, \PDO::PARAM_INT);
$stmt->bindValue('s', 'hello');
$stmt->execute();
$stmt->setFetchMode(\PDO::FETCH_ASSOC);
foreach ($stmt AS $row) {
    print_r($row);
}

/* output:
Array
(
    [num] => 123
    [str] => hello
)
*/
```

For more information about how to use PDO follow official documentation at [php.net](https://www.php.net/manual/en/book.pdo.php).

### DSN

[](#dsn)

KeyDescriptionhostThe hostname on which the database server resides.portThe port number where the database server is listening.dbnameThe name of the database.appnameThe application name (used as UserAgent).### PDO constructor available options

[](#pdo-constructor-available-options)

KeyDescriptionauthSpecify authentication method (none/basic/bearer/kerberos). Automatically detected.sslEnable encrypted communication and set ssl context options (see [php.net](https://www.php.net/manual/en/context.ssl.php))protocol\_versionsSpecify requested bolt versions. Array of versions as int/float/string.*Check method annotation for more informations.*

### Yii framework

[](#yii-framework)

You can use this library with Yii framework in very simple way. Just set up in configuration your PDO class.

Bolt specific features
----------------------

[](#bolt-specific-features)

### Parameter placeholders

[](#parameter-placeholders)

Supported parameter placeholder for CQL is `?` or string with `$` prefix.

*Don't use placeholder string with `:` prefix because CQL use `:` for labels prefix.*

### PDO Method `reset()`

[](#pdo-method-reset)

Graph database can be in failure state (*error code 02001*) and any next message is ignored (*error code 02002*). Instead of destroying PDO instance and creating new, you can call this method.

### PDO::PARAM\_LOB

[](#pdoparam_lob)

Automatically converts resource or string into instance of Bytes class.

Additional bolt parameter types
-------------------------------

[](#additional-bolt-parameter-types)

ConstantDescriptionPDO::BOLT\_PARAM\_FLOATPDO::BOLT\_PARAM\_LISTArray witch consecutive numeric keys from 0.PDO::BOLT\_PARAM\_DICTIONARYObject or array which is not list.PDO::BOLT\_PARAM\_STRUCTUREClass extending IStructure.PDO::BOLT\_PARAM\_BYTESinstance of Bytes class.*List of usable parameters depends on graph database you use ([Neo4j](https://neo4j.com/docs/cypher-manual/current/syntax/values/#structural-types), [Memgraph](https://memgraph.com/docs/memgraph/reference-guide/data-types)).*

Not supported PDO features with Bolt
------------------------------------

[](#not-supported-pdo-features-with-bolt)

- Fetch mode `PDO::FETCH_LAZY`
- Fetch mode `PDO::FETCH_NAMED`
- PDO method `lastInsertId()`
- PDOStatement method `rowCount()`
- Scrollable cursor

Bolt error codes
----------------

[](#bolt-error-codes)

Standard PDO error codes are related to SQL databases. Graph database have CQL (Cypher query language) and therefore I had to create new list of error codes.

Error codeDescription01000Any authentification error01001Wrong credentials01002Undefined auth type02000Any bolt message error02001Bolt message failure02002Bolt message ignored03000Any transaction error03001Transaction not supported (required bolt&gt;=304000Any attribute error04001Attribute not supported05000Any parameter error05001Parameter type not supported05002Parameters placeholder mismatch06000Any fetch error06001Requested fetch column not defined06002Fetch object error07000Any underlying bolt library error

###  Health Score

18

—

LowBetter than 8% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~88 days

Total

2

Last Release

1156d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/04e29b3719023eae810d2f457310ac2f7deb64314e53795ca135dafd505ce4b2?d=identicon)[oLDo](/maintainers/oLDo)

---

Top Contributors

[![stefanak-michal](https://avatars.githubusercontent.com/u/5502917?v=4)](https://github.com/stefanak-michal "stefanak-michal (10 commits)")

---

Tags

amazon-neptuneboltdrivergraph-databasememgraphneo4jpdophpdatabaseSocketneo4jboltgraph databaseAmazon Neptunememgraph

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/stefanak-michal-pdo-bolt/health.svg)

```
[![Health](https://phpackages.com/badges/stefanak-michal-pdo-bolt/health.svg)](https://phpackages.com/packages/stefanak-michal-pdo-bolt)
```

###  Alternatives

[stefanak-michal/bolt

PHP library to provide connectivity to graph database over TCP socket with Bolt specification

79655.8k8](/packages/stefanak-michal-bolt)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

184616.9k31](/packages/laudis-neo4j-php-client)[vinelab/neoeloquent

Laravel wrapper for the Neo4j graph database REST interface

65393.1k1](/packages/vinelab-neoeloquent)[triagens/arangodb

ArangoDB PHP client

186189.4k19](/packages/triagens-arangodb)[graphaware/neo4j-common

Common Utilities library for Neo4j

24876.2k24](/packages/graphaware-neo4j-common)[neo4j/neo4j-bundle

Symfony integration for Neo4j

8272.1k](/packages/neo4j-neo4j-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
