PHPackages                             cupoftea/eloquent-snake-relations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. cupoftea/eloquent-snake-relations

ActiveLibrary[Database &amp; ORM](/categories/database)

cupoftea/eloquent-snake-relations
=================================

A simple trait to access your Eloquent relations using its snake\_case property

v1.1.0(7y ago)619MITPHP

Since May 10Pushed 7y ago1 watchersCompare

[ Source](https://github.com/CupOfTea696/EloquentSnakeCaseRelations)[ Packagist](https://packagist.org/packages/cupoftea/eloquent-snake-relations)[ RSS](/packages/cupoftea-eloquent-snake-relations/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/6a9306b9df2723b3369027e656325593297d04b762fa76f53f546b0a4207013c/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f656c6f7175656e742d736e616b652d72656c6174696f6e732f76657273696f6e2e737667)](https://packagist.org/packages/cupoftea/eloquent-snake-relations) [![Total Downloads](https://camo.githubusercontent.com/bef9b79a5909a566de3efeefbeb898a892df390c3bfd346f9b8baf123b2ed692/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f656c6f7175656e742d736e616b652d72656c6174696f6e732f642f746f74616c2e737667)](https://packagist.org/packages/cupoftea/cupoftea/eloquent-snake-relations) [![Latest Unstable Version](https://camo.githubusercontent.com/b7cee2696669bc5259d5db0f3b6897453ff24e36e992565f9fa7180deaabc5b2/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f656c6f7175656e742d736e616b652d72656c6174696f6e732f762f756e737461626c652e737667)](https://packagist.org/packages/cupoftea/eloquent-snake-relations)[![StyleCI](https://camo.githubusercontent.com/ee2c4155b8b79a6ccd5b3fdeb1be6f5a8ba05dccf6a54277f2380f07782fdc9a/68747470733a2f2f7374796c6563692e696f2f7265706f732f3138363035353032342f736869656c643f7374796c653d666c6174)](https://styleci.io/repos/186055024)[![License](https://camo.githubusercontent.com/30f7b88ded4a252786dd47f59e995ad8777e2b81532ab9ac618acdf243470a5b/68747470733a2f2f706f7365722e707567782e6f72672f6375706f667465612f656c6f7175656e742d736e616b652d72656c6174696f6e732f6c6963656e7365)](https://packagist.org/packages/eloquent-snake-relations/fluent)

Eloquent snake\_case Relations
==============================

[](#eloquent-snake_case-relations)

A simple trait to access your Eloquent relations using its snake\_case property

Installation
------------

[](#installation)

Install via composer by running `composer require cupoftea/eloquent-snake-relations`.

Once installed, Models created via the `make:model` command will automatically extend `CupOfTea\Database\Eloquent\Model` to allow relation access via the snake\_cased relation name.

To update the User Model, replace the `Illuminate\Foundation\Auth\User` import with `CupOfTea\Auth\User`. You can keep the alias used for the import.

If you have already created some Models in your Application, simply replace the `Illuminate\Database\Eloquent\Model` import with `CupOfTea\Database\Eloquent\Model`, or for Pivot Models, replace the `Illuminate\Database\Eloquent\Relations\Pivot` import with `CupOfTea\Database\Eloquent\Relations\Pivot`.

Alternatively, if you are extending your own Model class, you can use the `CupOfTea\Database\Eloquent\Concerns\HasSnakeCaseRelations` trait on that Model, or extend it from `CupOfTea\Database\Eloquent\Model` instead of `Illuminate\Database\Eloquent\Model`.

Usage
-----

[](#usage)

To access your model relations, you can now use the snake\_case property, even if your relation method is camelCase. For example, if your your relationship method is defined as `User::creditCards()`, you can access it via `$user->credit_cards`.

> **Note**: Please note that only property access can use snake\_case. Additional relationship queries or eager loading should still use the relationship method name as is. For example, `$creditCards = User::find(1)->creditCards()->orderBy('expires')->get();`, or `$users = User::with('creditCards')->all();`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2560d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2977bc0c1a9c62466102bce06ba22bca2897d5a0176087f2c6d8924e55f60c42?d=identicon)[CupOfTea696](/maintainers/CupOfTea696)

---

Top Contributors

[![CupOfTea696](https://avatars.githubusercontent.com/u/7327050?v=4)](https://github.com/CupOfTea696 "CupOfTea696 (10 commits)")

### Embed Badge

![Health badge](/badges/cupoftea-eloquent-snake-relations/health.svg)

```
[![Health](https://phpackages.com/badges/cupoftea-eloquent-snake-relations/health.svg)](https://phpackages.com/packages/cupoftea-eloquent-snake-relations)
```

###  Alternatives

[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[genealabs/laravel-pivot-events

This package introduces new eloquent events for sync(), attach(), detach() or updateExistingPivot() methods on BelongsToMany relation.

1404.9M8](/packages/genealabs-laravel-pivot-events)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[aglipanci/laravel-eloquent-case

Adds CASE statement support to Laravel Query Builder.

115157.2k](/packages/aglipanci-laravel-eloquent-case)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
