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 configure this Neo4j client in Laravel?
Run `composer require laudis/neo4j-php-client`, then register the client in `config/services.php` with your Neo4j URI, username, and password. Use the `ClientBuilder` to initialize it in a service provider or facade, mirroring Laravel’s DI patterns. Example: `$this->app->singleton(Neo4jClient::class, fn() => ClientBuilder::create()->withDriver('bolt', config('neo4j.bolt_uri'))->withAuth(config('neo4j.username'), config('neo4j.password'))->build());`
Does this package support Laravel’s Eloquent or Query Builder?
No, this package provides direct Cypher query access via a typed API. However, you can build Laravel Query Builder wrappers (e.g., `Neo4j::match('User')->where('age', '>', 25)`) or use it alongside Eloquent for polyglot persistence (e.g., relational data in MySQL + graph data in Neo4j).
Which Laravel versions are compatible with this Neo4j client?
The package supports PHP 8.1+ and is framework-agnostic, but the official Laravel examples (like the RealWorld app) use Laravel 9+. Test compatibility by checking the `composer.json` constraints and the [Laravel-Neo4j RealWorld example](https://github.com/neo4j-examples/php-laravel-neo4j-realworld-example).
How do I handle complex Cypher queries in Laravel controllers?
Use the client’s `run()` method for raw Cypher or chain query builders for readability. For example: `$results = $client->run('MATCH (u:User)-[:FRIENDS_WITH]->(friend) RETURN u, friend')->toArray();`. Wrap repetitive queries in service classes or repositories to avoid controller bloat.
Can I use this for production workloads? What about retries and transactions?
Yes, it’s production-ready with Bolt driver support and auto-retry for transient errors. Use unmanaged transactions for complex workflows (e.g., `client->beginTransaction()`) and leverage Neo4j’s bookmarks for large traversals. Pin the package version in `composer.json` for stability.
How do I integrate Neo4j events with Laravel’s event system?
Dispatch Laravel events after Neo4j operations by listening to the client’s callbacks. Example: `event(new NodeCreated($node));` in a service layer. Useful for triggering notifications (e.g., `neo4j.node.created`) or syncing with other systems.
What are the alternatives to this Neo4j PHP client for Laravel?
Alternatives include `jadc/neo4j-php-client` (older, less maintained) or building a custom wrapper around the [official Neo4j PHP driver](https://github.com/neo4j/neo4j-php-client). This package stands out for its typed API, Laravel integration examples, and validation via Neo4j Testkit.
How do I test Neo4j queries in Laravel’s PHPUnit/Pest tests?
Use Dockerized Neo4j instances (e.g., `testcontainers/neo4j`) for isolated tests. Example: `$neo4j = new Container('neo4j:latest'); $client = ClientBuilder::create()->withDriver('bolt', $neo4j->getEndpoint())->build();` Mock complex queries with factories or seed test data via Cypher.
Should I use Neo4j for all data or just graph relationships?
Neo4j excels for graph-heavy data (e.g., social networks, recommendations). Use it as a supplemental store for relationships while keeping transactional data (e.g., user profiles) in relational databases. Example: Store `users` in MySQL but `friendships` in Neo4j.
How do I cache frequent Cypher query results in Laravel?
Cache results using Laravel’s cache drivers. Example: `Cache::remember('user_123_friends', now()->addHours(1), fn() => $client->run('MATCH (u:User {id: $id})<-[:FRIENDS_WITH]-(friend) RETURN friend')->toArray());` Avoid caching mutable data or queries with dynamic parameters.
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.
codraw/entity-migrator
codraw/doctrine-extra
codraw/aws-tool-kit
codraw/validator
codraw/workflow
codraw/open-api
codraw/cron-job
codraw/process
codraw/log
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony