PHPackages                             ramadan/easy-model - 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. ramadan/easy-model

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

ramadan/easy-model
==================

A Laravel package for enjoyably managing database queries.

v2.0.0(3w ago)111.6kMITPHPPHP ^8.2

Since Oct 1Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/mahmoudmohamedramadan/easy-model)[ Packagist](https://packagist.org/packages/ramadan/easy-model)[ Docs](https://github.com/mahmoudmohamedramadan/easy-model)[ Fund](https://buymeacoffee.com/mmramadan496)[ GitHub Sponsors](https://github.com/sponsors/mahmoudmohamedramadan)[ RSS](/packages/ramadan-easy-model/feed)WikiDiscussions 1.x Synced yesterday

READMEChangelog (10)Dependencies (5)Versions (29)Used By (0)

Easy Model
==========

[](#easy-model)

[![Easy Model](/art/logo.png "Easy Model")](/art/logo.png)

[![Latest Version](https://camo.githubusercontent.com/616e97b50660e25fe097032d795237e50206eac4d49f7264ba9a17c2f8865704/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374)](https://camo.githubusercontent.com/616e97b50660e25fe097032d795237e50206eac4d49f7264ba9a17c2f8865704/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265266c6f676f3d7061636b6167697374)[![Total Downloads](https://camo.githubusercontent.com/75cc72939eeb721887c041fcc879d466b6ad3ffe89991b4440ea2d1c03527a8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/75cc72939eeb721887c041fcc879d466b6ad3ffe89991b4440ea2d1c03527a8b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265)[![PHP](https://camo.githubusercontent.com/b9628818f912d5bac5fd3bddf227fc5bc9da200afb27c14ec745a35bfaebc292/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f6c6f676f3d706870267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/b9628818f912d5bac5fd3bddf227fc5bc9da200afb27c14ec745a35bfaebc292/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d3737374242343f6c6f676f3d706870267374796c653d666c61742d737175617265)[![Laravel](https://camo.githubusercontent.com/520665a81012bd76b2f3f7f8377217ae2ca3a1f2b7abe13212d1c875bfece698/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025374325354531312e3025374325354531322e3025374325354531332e302d4646324432303f6c6f676f3d6c61726176656c267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/520665a81012bd76b2f3f7f8377217ae2ca3a1f2b7abe13212d1c875bfece698/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d25354531302e3025374325354531312e3025374325354531322e3025374325354531332e302d4646324432303f6c6f676f3d6c61726176656c267374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/d1f1a06afa6855414dc8df2ea33059a55cf7fb1af6e795af5d339501f2f0869c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/d1f1a06afa6855414dc8df2ea33059a55cf7fb1af6e795af5d339501f2f0869c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d6164616e2f656173792d6d6f64656c3f7374796c653d666c61742d737175617265)

---

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [Support Me](#support-me)

Overview
--------

[](#overview)

Why this package?

**I am focused on simplifying the syntax to match my vision, making it easier for you to perform tasks that typically require more lines of code or effort in Laravel. I am also addressing issues that Laravel still faces. The package is actively maintained, and I regularly review closed PRs in Laravel to find methods to help achieve this.**

What makes this package featured?

- **Accelerated Query Performance:**

    - Significantly improved query performance compared to native Laravel.
- **Straightforward and Unified Syntax:**

    - Provides a unified, consistent syntax for `Query Builder` and `Eloquent Builder`. For more details, see [Establish Query](SEARCH.md#establish-query).
- **Resolved Ambiguous Exception:**

    - Fixes the ambiguous exception that arises when using the same column in both models and their relationships during ordering.
- **Simplified Relationship Ordering:**

    - Easily order results by model relationships (`HasOne`, `HasMany`, `BelongsTo`, `BelongsToMany`) without referring to manual joins. Check out [Order Results](SEARCH.md#order-results) to learn more.
- **Streamline Batch Updates:**

    - Effortlessly perform multiple updates using concise methods, consult [UPDATE.md](UPDATE.md).
- **Polymorphic &amp; Through Relationship Ordering:**

    - Adds first-class ordering support for `MorphOne`, `MorphMany`, `MorphToMany`, `HasOneThrough`, and `HasManyThrough` relationships using safe `LEFT JOIN` handling and automatic per-query join deduplication.
- **Aggregate Ordering Helpers:**

    - Order results by `COUNT`, `SUM`, `AVG`, `MIN`, or `MAX` of a related relationship via `addOrderByCount` / `addOrderByAggregate`.
- **Keyword Search Across Columns:**

    - Run a single grouped `LIKE`/`=` search across multiple columns with `addKeywordSearch`.
- **Drop-in Facade:**

    - Skip the trait entirely and use `EasyModel::for(User::class)->...` from anywhere.
- And more...

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

[](#installation)

Install the package by using [Composer](https://getcomposer.org/):

```
composer require ramadan/easy-model
```

Usage
-----

[](#usage)

Warning

Do not use both traits together, as doing so may lead to unexpected output. However, if you do, the highest priority will be given to the **Searchable** trait.

For comprehensive examples and in-depth usage guidelines, check out [SEARCH.md](SEARCH.md) and [UPDATE.md](UPDATE.md).

Credits
-------

[](#credits)

- [Mahmoud Ramadan](https://github.com/mahmoudmohamedramadan)
- [Contributors](https://github.com/mahmoudmohamedramadan/easy-model/graphs/contributors)

Support me
----------

[](#support-me)

- [PayPal](https://paypal.com/paypalme/mmramadan496)

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance94

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

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 ~23 days

Recently: every ~9 days

Total

28

Last Release

22d ago

Major Versions

v1.2.0 → 2.x-dev2026-06-11

PHP version history (2 changes)v1.0.0-alpha.1PHP ^8.0

v1.1.6PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b7e0489f88088d2d0a437fb20d6925d593f8212b58f41daffadfebf5f52ab36?d=identicon)[mmramadan496](/maintainers/mmramadan496)

---

Top Contributors

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

---

Tags

composerdatabaseeasy-modeleloquentlaravelmssqlmysqlormpdosqlsqlitesqlserverlaraveldatabaseormmysqlsqlitepostgresqlmariadbqueryobjectsqlpdopgsqlsqlservermssqleasy-model

### Embed Badge

![Health badge](/badges/ramadan-easy-model/health.svg)

```
[![Health](https://phpackages.com/badges/ramadan-easy-model/health.svg)](https://phpackages.com/packages/ramadan-easy-model)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k605.0M6.8k](/packages/doctrine-dbal)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4883.1M39](/packages/aura-sqlquery)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86849.1k](/packages/ezsql-ezsql)[api-platform/laravel

API Platform support for Laravel

58171.5k14](/packages/api-platform-laravel)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

44243.2k4](/packages/aura-sqlschema)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

846.1k](/packages/tommyknocker-pdo-database-class)

PHPackages © 2026

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