Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Neo4J Php Client

Neo4J Php Client Laravel Package

laudis/neo4j-php-client

Typed Neo4j PHP client/driver with Bolt and Neo4j (auto-routed) support. Intuitive, extensible API with easy configuration, built with input from the official driver team and validated via Neo4j Testkit for reliability.

View on GitHub
Deep Wiki
Context7

Php client and driver for neo4j database

Frequently asked questions about Neo4J Php Client
How do I install and set up laudis/neo4j-php-client in a Laravel project?
Install via Composer with `composer require laudis/neo4j-php-client`. Register the client in Laravel’s `config/services.php` or a service provider using `ClientBuilder`. The package supports both Bolt (recommended) and HTTP drivers. For Laravel-specific examples, check the [RealWorld Laravel example](https://github.com/neo4j-examples/php-laravel-neo4j-realworld-example).
Does this package work with Laravel Eloquent, or is it a standalone Neo4j driver?
This is a standalone Neo4j driver, not Eloquent-specific. However, you can abstract it into a Laravel service provider or facade to mimic Eloquent patterns. For example, map Eloquent `User` models to Neo4j nodes and handle relationships via custom repositories. The RealWorld example demonstrates this hybrid approach.
What Laravel versions and PHP versions are supported by this Neo4j client?
The package supports PHP 8.0+ and integrates with Laravel’s service container (tested with Laravel 8+). It has no Laravel-specific dependencies, so it works as long as your project meets the PHP version requirement. Always check the [Packagist page](https://packagist.org/packages/laudis/neo4j-php-client) for the latest compatibility details.
How do I handle transactions in this Neo4j client for Laravel?
Use `readTransaction()` or `writeTransaction()` for atomic operations. For example: `$result = $client->executeRead(function (Driver $driver) { return $driver->executeQuery('MATCH (n) RETURN n'); });`. Transactions ensure idempotency and safety, especially in Laravel’s request lifecycle. Avoid side effects outside transactions.
Can I use this client for hybrid architectures (e.g., PostgreSQL + Neo4j) in Laravel?
Yes, this client is ideal for polyglot persistence. Store relational data (e.g., user profiles) in PostgreSQL/MySQL and graph data (e.g., friendships) in Neo4j. Use Laravel’s service container to manage both connections. The RealWorld example shows how to combine Eloquent and Neo4j queries seamlessly.
What’s the best way to manage Neo4j schema changes in a Laravel project?
Neo4j uses Cypher for schema management, not Laravel migrations. Store Cypher scripts in `database/neo4j` and run them via a Laravel Artisan command or a service provider. Tools like Neo4j Browser or `neo4j-admin` can also apply schema changes. Version-control scripts alongside your Laravel codebase.
Does this client support Neo4j’s full-text search or vector search (Neo4j 5+)?
The client supports Neo4j 5+ features, including vector search, but vector queries must be constructed manually in Cypher. Full-text search is available via Cypher’s `CALL db.index.fulltext.queryNodes()` or `db.index.fulltext.queryRelationships()`. Check Neo4j’s [documentation](https://neo4j.com/docs/cypher-manual/current/) for syntax.
How do I configure connection pooling or high availability for Neo4j in Laravel?
Use `ClientBuilder` to configure connection pooling via `withConnectionPoolOptions()`. For high availability, enable auto-routing in the Bolt driver: `$client = ClientBuilder::create()->withDriver(new BoltDriver(['bolt://host1:7687', 'bolt://host2:7687']), 'neo4j', 'password')->build()`. Monitor Neo4j clusters or use AuraDB for managed HA.
Are there alternatives to this Neo4j client for Laravel, and why should I choose this one?
Alternatives include the older `jenssegers/neo4j` or raw Bolt protocol libraries, but this client is the most modern, typed, and officially validated by Neo4j. It supports Bolt (low-latency), auto-routing, and integrates with Laravel’s ecosystem via PSR standards. The RealWorld example proves its Laravel readiness.
How do I test Neo4j queries in Laravel’s testing environment?
Use Laravel’s `DatabaseTransactions` trait to wrap Neo4j operations in transactions. For example: `public function testFriendship() { $this->withoutExceptionHandling(); $this->actingAs($user)->post('/friends', ['id' => $friend->id]); $this->assertDatabaseHas('neo4j', ['query' => 'MATCH (u:User)-[:FRIENDS_WITH]->(f:User) RETURN u, f']); }`. Mock the client in unit tests with interfaces.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle