global-innovation/neo4j-laravel-eloquent
Brings native Neo4j graph database support to Laravel's Eloquent ORM. Define nodes and relationships as Eloquent models, run Cypher queries through a fluent query builder, traverse graphs via relationships, and manage schemas with Laravel-native syntax, migrations, and conventions.
Architecture fit. This package implements an Eloquent-style model layer over Neo4j, letting Laravel developers define graph nodes/relationships as classes with familiar idioms (attributes, relationship methods, query chaining) instead of hand-writing Cypher. The fit is strong only in one specific architecture: a relational system of record (MySQL/Postgres) that owns users, billing, and transactional data, with Neo4j added as a secondary graph store for traversal-heavy domains — social graphs, recommendations, fraud rings, RBAC/permission hierarchies, knowledge graphs, lineage. It is a poor fit as a wholesale Eloquent replacement: Neo4j has no schema migrations, no joins, and different transactional and indexing semantics, so the abstraction will leak whenever a query is more than a shallow traversal.
Integration feasibility. Mechanically low-friction: Composer install, a neo4j connection block in config/database.php, and model classes extending the package base. The real cost is not installation but the impedance mismatch — developers will discover mid-sprint that eager loading, whereHas, chunking, aggregates, and pagination behave differently or are unimplemented. Budget a spike to enumerate which Eloquent features actually work before committing to a design that assumes parity.
Technical risk.
Key questions.
elementId or the deprecated integer id? This determines forward compatibility.whereHas, pagination, chunking, aggregates, transactions, soft deletes?Stack fit. Targets a modern Laravel (9–11) / PHP 8.1+ codebase with Bolt connectivity. It composes cleanly with Laravel's service container, config, and queue system; the graph connection can sit alongside existing SQL connections without disturbing them. Prerequisite: a provisioned Neo4j instance (self-hosted or Aura) and network egress over Bolt (7687), which is often the first surprise in locked-down VPCs.
Migration path. Do not migrate. Use a strangler-style addition: keep SQL as the system of record, introduce Neo4j for one bounded, traversal-shaped capability, and project only the subgraph that capability needs. Sync via domain events → queue → idempotent upserts (outbox pattern with a checkpoint), never synchronous dual-writes from the request path.
Compatibility. Verify elementId support, authentication mode (basic vs bearer/Aura), TLS settings, and timezone/type mapping (Neo4j temporal and spatial types vs PHP). Pin both the package and the Neo4j server minor version; treat driver upgrades as deliberate, tested events.
Sequencing.
Maintenance. Treat the package as a thin, replaceable adapter, not a foundational dependency: wrap it behind your own interfaces, pin versions, and be prepared to vendor/fork. Low release cadence means security and compatibility fixes may be your responsibility. Ongoing cost is modest for one bounded use case, but rises with every Eloquent feature you need and don't get.
Support. MIT, community-only, no vendor SLA. Internal ownership must be explicit — one or two engineers who can read Cypher and EXPLAIN/PROFILE a plan. Escalation path is upstream issues plus your own fork; plan accordingly for a Tier-1 feature.
Scaling. Graph performance is a function of traversal depth and fan-out, not row count — the opposite of the SQL intuition your team has. Enforce maximum traversal depth, LIMIT on every variable-length path, and pagination at the API boundary. Watch connection-pool sizing against Neo4j's per-database limits, and note that clustered/Aura deployments require routing-aware drivers. The projection pipeline (queue workers) becomes a scaling surface of its own under backfill or replay.
Failure modes.
* path on a dense node exhausts heap and stalls the instance; guard at the query layer.Ramp-up. A mid-level Laravel developer should be productive with the model layer in days, but productive with the graph in roughly one to two sprints — the gap is Cypher, data modeling (nodes vs properties vs relationships), and query-plan reading. Because the abstraction hides Cypher, that training is non-optional: without it the team cannot debug what the ORM generates. Net assessment: a reasonable, low-cost bet for a single graph-shaped feature in an existing Laravel app, contingent on the spike confirming feature coverage and on accepting single-maintainer risk; not a candidate for core-domain persistence.
How can I help you explore Laravel packages today?