PHPackages                             fatihirday/eloquent - 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. fatihirday/eloquent

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

fatihirday/eloquent
===================

additional features to eloquent

v0.1.0(4y ago)17[1 issues](https://github.com/fatih-irday-01/eloquent/issues)MITPHPPHP ^7.3|^8.0

Since Feb 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/fatih-irday-01/eloquent)[ Packagist](https://packagist.org/packages/fatihirday/eloquent)[ RSS](/packages/fatihirday-eloquent/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

[Additional Features to Eloquent](http://www.fatihirday.com.tr/)
----------------------------------------------------------------

[](#additional-features-to-eloquent)

- ifNull
- ifCount
- ifSum
- sumColumn
- countColumn
- concat
- caseWhen
- whereLike
- orWhereLike
- getSql
- dumpSql
- ddSql

---

### Installation

[](#installation)

bash command

```
composer require fatihirday/eloquent
```

add provider to `config/app.php`

```
'providers' => [
    // ...
    Fatihirday\Eloquent\EloquentServiceProvedir::class,
],
```

---

### Documentation

[](#documentation)

Prepared for **Mysql** and **PostgreSql**

#### - ifNull

[](#--ifnull)

Return the specified value IF the expression is NULL, otherwise return the expression

```
Model::ifNull('column', 'value', 'responseName');
// or
Model::query()->ifNull('column', 'value', 'responseName');
```

#### - ifCount

[](#--ifcount)

Count of values satisfying the if condition

```
Model::ifCount('column', 12, 'responseName');
// or
Model::ifCount('column', '!=', 'value', 'responseName');
```

#### - ifSum

[](#--ifsum)

Sum of values satisfying the if condition

```
Model::ifSum('column', '!=', 'value', 'responseName');
// or
Model::ifSum('column', '=', 'value', 'sumColumn', 'responseName');
```

#### - sumColumn

[](#--sumcolumn)

```
Model::sumColumn('column'); // sum(column) as column
// or
Model::sumColumn('column', 'responseName'); // sum(column) as responseName
```

#### - countColumn

[](#--countcolumn)

```
Model::countColumn('column'); // count(column) as column
// or
Model::countColumn('column', 'responseName'); // count(column) as responseName
```

#### - concat

[](#--concat)

```
Model::concat(['name', 'id'], 'responseName') // nameid
// or
Model::concat(['name', 'id'], 'responseName', '-') // name-id
```

#### - caseWhen

[](#--casewhen)

```
Model::caseWhen([
    'updated_at > created_at' => 'updated_at', // When Then
    'deleted_at > created_at' => 'deleted_at', // When Then
    'created_at', // Else
], 'responseName')
```

#### - whereLike

[](#--wherelike)

```
use Fatihirday\Eloquent\Libraries\Enums\Like;

Model::whereLike('columnName', 'value', Like::FIRST);
// WHERE columnName like '%value'

Model::whereLike('columnName', 'value', Like::MIDDLE);
// WHERE columnName like '%value%'

Model::whereLike('columnName', 'value', Like::LAST);
// WHERE columnName like 'value%'
```

#### - orWhereLike

[](#--orwherelike)

```
use Fatihirday\Eloquent\Libraries\Enums\Like;

Model::where('id', '>', 1)->orWhereLike('columnName', 'value', Like::FIRST);
// WHERE id > 1 or columnName like '%value'

Model::where('id', '>', 1)->orWhereLike('columnName', 'value', Like::MIDDLE);
// WHERE id > 1 or columnName like '%value%'

Model::where('id', '>', 1)->orWhereLike('columnName', 'value', Like::LAST);
// WHERE id > 1 or columnName like 'value%'
```

#### - getSql

[](#--getsql)

toSql and getBindings merge

```
echo Model::where('name', 'value')->getSql();
// select * from `table_name` where `name` = 'fatih'
```

#### - dumpSql

[](#--dumpsql)

dump for getSql

```
Model::where('name', 'value')->dumpSql();
// select * from `table_name` where `name` = 'fatih'
```

#### - ddSql

[](#--ddsql)

dd for getSql

```
Model::where('name', 'value')->ddSql();
// select * from `table_name` where `name` = 'fatih'
```

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1585d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5274e19713d1f1accb92e38f6fb40430b3fb99c272088317b1064a526622ac70?d=identicon)[fatihirday](/maintainers/fatihirday)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/fatihirday-eloquent/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)

PHPackages © 2026

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