staudenmeir/eloquent-json-relations
Adds JSON foreign key support to Laravel Eloquent relationships (belongsTo, hasMany, morph*, through). Also enables many-to-many and has-many-through relations using JSON arrays (IDs or objects) across MySQL, Postgres, SQLite, SQL Server.
Architecture fit: Excellent alignment with Laravel's Eloquent ORM, extending core relationship patterns without reinventing APIs. Uses Laravel's native JSON query capabilities, ensuring consistency with existing model behaviors. Integrates seamlessly into typical Laravel stack patterns where JSON columns are used for flexible schema design.
Integration feasibility: High feasibility via Composer dependency; requires Laravel 8+ (per common package patterns) and a JSON-capable database (MySQL 5.7+, PostgreSQL, or SQLite 3.9+). Minimal code changes needed for relationship definitions, but requires validation of current JSON column structures (e.g., array of IDs vs. nested objects). Database-specific JSON function support must be confirmed.
Technical risk: Moderate performance concerns with large JSON datasets (e.g., 10k+ IDs in a single column), as JSON queries may not scale as efficiently as traditional joins. Risk of breaking changes if Laravel updates JSON query internals. Package maintenance status is unclear despite 1075 stars (last release dated 2026-03-01, which appears erroneous—requires verification of actual release timeline).
Key questions:
Stack fit: Ideal for Laravel projects using JSON columns for relationships (e.g., tagging systems, multi-tenant data, or schema-less features). Fully compatible with Laravel's existing Eloquent
How can I help you explore Laravel packages today?