PHPackages                             tishotm/eloquent-ci-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. tishotm/eloquent-ci-relations

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

tishotm/eloquent-ci-relations
=============================

Eloquent case-insensitive relations

v1.5.0(11mo ago)641.5k↓38.3%6MITPHPCI passing

Since Sep 15Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/TishoTM/eloquent-ci-relations)[ Packagist](https://packagist.org/packages/tishotm/eloquent-ci-relations)[ RSS](/packages/tishotm-eloquent-ci-relations/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (15)Used By (0)

Eloquent case-insensitive relations
===================================

[](#eloquent-case-insensitive-relations)

[![Build Status](https://github.com/TishoTM/eloquent-ci-relations/actions/workflows/tests.yml/badge.svg)](https://github.com/TishoTM/eloquent-ci-relations/actions)[![Version](https://camo.githubusercontent.com/c7489635f85796fb0fdf71e8218e415decf0b6d59246ecef603bf9b1223ac307/68747470733a2f2f706f7365722e707567782e6f72672f746973686f746d2f656c6f7175656e742d63692d72656c6174696f6e732f76657273696f6e)](https://packagist.org/packages/tishotm/eloquent-ci-relations)[![Total Downloads](https://camo.githubusercontent.com/3132d68f713b08bbf1ddce7cb714928926f5e0fe1cf75030aa785765ee354920/68747470733a2f2f706f7365722e707567782e6f72672f746973686f746d2f656c6f7175656e742d63692d72656c6174696f6e732f646f776e6c6f616473)](https://packagist.org/packages/tishotm/eloquent-ci-relations)[![License](https://camo.githubusercontent.com/f5c2bf567fb721c441aa0708a1c8550146b4aa4fd7ac10288f4710a658a9d2cd/68747470733a2f2f706f7365722e707567782e6f72672f746973686f746d2f656c6f7175656e742d63692d72656c6174696f6e732f6c6963656e7365)](https://packagist.org/packages/tishotm/eloquent-ci-relations)

Using Eloquent out of the box on case-insensitive collation databases could potentially return incomplete collection of items if the foreign keys are set as strings and they differ in terms of uppercase vs lowercase. On eager loaded relations Eloquent builds a dictionary of the parent models and associates their related models by their keys. PHP is case-sensitive and therefore if the keys are different, then some of the related models will not be returned. This package simply normalizes the dictionary keys into lowercase.

Example:

**Items table**

uuidnameaaaFirstbbbSecondcccThird**Tags table**

idlabel1tag 12tag 23tag 3**item\_tag table**

item\_uuidtag\_idAAA1aaa2bbb3`Item::with('tags')->find('aaa');`

The related tags would include only the "tag 2" even if the the DB collation is case-insensitive and the returned query data includes "tag 1".

**With case insensitive relations:** The related tags would include both "tag 1" and "tag 2".

Requirements
------------

[](#requirements)

- illuminate/database 5.5.33 and up, 5.6.\*, 5.7.\*, 5.8.\*, 6.20.26 and up, 7.30.4, 8.40.0 an up

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

[](#installation)

`composer require tishotm/eloquent-ci-relations`

Usage
-----

[](#usage)

```
use Illuminate\Database\Eloquent\Model;

class Item extends Model
{
    use \TishoTM\Eloquent\Concerns\HasCiRelationships;

    // ... relations
}
```

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT).

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance50

Moderate activity, may be stable

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 86.2% 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 ~245 days

Recently: every ~363 days

Total

8

Last Release

354d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b2967af141eff72496dec67466a7794f108dc4eb285d3cb5de7b0db75e450305?d=identicon)[TishoTM](/maintainers/TishoTM)

---

Top Contributors

[![TishoTM](https://avatars.githubusercontent.com/u/2495428?v=4)](https://github.com/TishoTM "TishoTM (25 commits)")[![asterd](https://avatars.githubusercontent.com/u/734776?v=4)](https://github.com/asterd "asterd (3 commits)")[![d13r](https://avatars.githubusercontent.com/u/236616?v=4)](https://github.com/d13r "d13r (1 commits)")

---

Tags

case-insensitiveeloquent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tishotm-eloquent-ci-relations/health.svg)

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

###  Alternatives

[owen-it/laravel-auditing

Audit changes of your Eloquent models in Laravel

3.4k33.0M95](/packages/owen-it-laravel-auditing)[staudenmeir/eloquent-json-relations

Laravel Eloquent relationships with JSON keys

1.1k5.8M24](/packages/staudenmeir-eloquent-json-relations)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.1M11](/packages/bavix-laravel-wallet)[dragon-code/migrate-db

Easy data transfer from one database to another

15717.4k](/packages/dragon-code-migrate-db)[gearbox-solutions/eloquent-filemaker

A package for getting FileMaker records as Eloquent models in Laravel

6454.8k2](/packages/gearbox-solutions-eloquent-filemaker)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)

PHPackages © 2026

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