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.6.0(3w ago)645.5k↓77.4%6MITPHPCI passing

Since Sep 15Pushed 3w 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 2d ago

READMEChangelog (9)Dependencies (6)Versions (17)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

56

—

FairBetter than 97% of packages

Maintenance95

Actively maintained with recent releases

Popularity37

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 87.1% 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 ~261 days

Recently: every ~382 days

Total

9

Last Release

23d 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 (27 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

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[kirschbaum-development/eloquent-power-joins

The Laravel magic applied to joins.

1.6k32.6M46](/packages/kirschbaum-development-eloquent-power-joins)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[awobaz/compoships

Laravel relationships with support for composite/multiple keys

1.2k11.7M47](/packages/awobaz-compoships)[bavix/laravel-wallet

It's easy to work with a virtual wallet.

1.3k1.3M19](/packages/bavix-laravel-wallet)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)

PHPackages © 2026

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