imanghafoori/eloquent-relativity
Laravel package that lets you declare Eloquent relationships without importing related model classes. Relativity infers the target model from the method name, so hasMany, hasOne, belongsTo and belongsToMany calls stay concise and your models keep fewer use statements.
Architecture fit
$this->hasMany(Comment::class)) with string-keyed lookups ($this->relTo('comments')), resolved through a central key→class map registered in a service provider/config.Billing module must not use App\Modules\Users\Models\User.Integration feasibility
Technical risk
Key questions
Relation instances (so with(), whereHas(), withCount(), hasManyThrough, morph relations all behave identically)?Relation::enforceMorphMap handled — do the two mappings conflict?relTo, and can it be swapped for a thin internal wrapper?Stack fit
Migration path
relTo in a project-owned trait so the vendor dependency is one file deep and replaceable.Compatibility
for(), and route model binding/policy auto-discovery.instanceof checks on relation objects are the highest-probability breakpoints.Sequencing
Maintenance
Support
Scaling
Failure modes
Ramp-up
TPM verdict
Model::resolveRelationUsing, container-bound interfaces, or boundary enforcement in CI without a single-maintainer dependency. Given zero dependents and a 2024 release with no visible momentum, adopt only where the modular-boundary value is concrete, behind a wrapper seam, and after tooling validation — not as a default architecture choice.How can I help you explore Laravel packages today?