stefanak-michal/bolt
Low-level PHP Bolt protocol driver (Bolt <= 6) for TCP socket communication with graph databases like Neo4j, Memgraph, Amazon Neptune, and others. Supports PHP 8.1+ and tracks official protocol message specifications across versions.
run/pull operations), reducing latency for batch operations—a critical feature for Laravel’s async job queues or bulk data processing.// Custom Graph Query Builder
class GraphQueryBuilder {
public function run(string $cypher, array $params): array {
$bolt = (new Bolt(new Socket('127.0.0.1', 7687)))
->setProtocolVersions(5.4)
->build();
return $bolt->run($cypher, $params)->pullAll()->getResponses();
}
}
hello/logon/run/pull), increasing boilerplate. Mitigation: Use the Client helper or wrap in a Laravel service.DatabaseManager.Response::isSuccess().begin/commit/rollback.)DatabaseManager could abstract this.)Illuminate\Database\Connectors\ConnectionFactory) or service container binding.Illuminate\Database\Query\Builder to support Cypher queries.// Artisan command to sync users to Neo4j
$bolt = app(BoltService::class);
foreach (User::all() as $user) {
$bolt->run("CREATE (u:User {id: \$id, name: \$name})", [
'id' => $user->id,
'name' => $user->name
]);
}
setProtocolVersions(4.4)).Auth system).array → List, object → Dictionary).begin/commit for multi-query operations.7687).config/database.php:
'connections' => [
'neo4j' => [
'driver' => 'bolt',
'host' => env('NEO4J_HOST', '127.0.0.1'),
'port' => env('NEO4J_PORT', 7687),
'username' => env('NEO4J_USER'),
'password' => env('NEO4J_PASSWORD'),
'protocol_versions' => [5.4],
],
],
Illuminate\Database\Connection).class BoltConnection extends Connection {
public function run($query, $bindings = [], $useReadPdo = true) {
$bolt = (new Bolt(new Socket($this->config['host'], $this->config['port'])))
->setProtocolVersions($this->config['protocol_versions'])
->build();
return $bolt->run($query, $bindings)->pullAll()->getResponses();
}
}
DatabaseMigrations.mbstring, sockets) in php.ini.Bolt::$debug = true) for troubleshooting.Log facade.neo4j-admin or Neo4j Bloom.DB::enableQueryLog().INVALID_SIGNATURE).How can I help you explore Laravel packages today?