https://github.com/mahmoudmohamedramadan/easy-model
A Laravel package for enjoyably managing database queries.
https://github.com/mahmoudmohamedramadan/easy-model
composer database easy-model eloquent laravel mssql mysql orm pdo sql sqlite sqlserver
Last synced: 21 days ago
JSON representation
A Laravel package for enjoyably managing database queries.
- Host: GitHub
- URL: https://github.com/mahmoudmohamedramadan/easy-model
- Owner: mahmoudmohamedramadan
- Created: 2024-09-30T08:51:27.000Z (over 1 year ago)
- Default Branch: 1.x
- Last Pushed: 2026-05-10T19:30:51.000Z (about 1 month ago)
- Last Synced: 2026-05-10T21:27:29.827Z (about 1 month ago)
- Topics: composer, database, easy-model, eloquent, laravel, mssql, mysql, orm, pdo, sql, sqlite, sqlserver
- Language: PHP
- Homepage:
- Size: 1.59 MB
- Stars: 10
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Easy Model






- - -
- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [Credits](#credits)
- [Support Me](#support-me)
## 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 & 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
Install the package by using [Composer](https://getcomposer.org/):
```SHELL
composer require ramadan/easy-model
```
## 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
- [Mahmoud Ramadan](https://github.com/mahmoudmohamedramadan)
- [Contributors](https://github.com/mahmoudmohamedramadan/easy-model/graphs/contributors)
## Support me
- [PayPal](https://paypal.com/paypalme/mmramadan496)
## License
The MIT License (MIT).