PHPackages                             onelearningcommunity/grease - 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. onelearningcommunity/grease

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

onelearningcommunity/grease
===========================

Opt-in performance optimizations for Eloquent's hot path, built from optimizations declined upstream. Zero core changes, byte-identical output.

v0.2.0(today)02↑2900%MITPHPPHP ^8.2CI passing

Since Jun 22Pushed todayCompare

[ Source](https://github.com/One-Learning-Community/grease)[ Packagist](https://packagist.org/packages/onelearningcommunity/grease)[ Docs](https://github.com/One-Learning-Community/grease)[ RSS](/packages/onelearningcommunity-grease/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Grease
======

[](#grease)

[![tests](https://github.com/One-Learning-Community/grease/actions/workflows/tests.yml/badge.svg)](https://github.com/One-Learning-Community/grease/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/47323f914d20ee553cef79538a612b60e7b42cc1872afad7e088656b78778ad9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6f6e656c6561726e696e67636f6d6d756e6974792f6772656173652e737667)](https://packagist.org/packages/onelearningcommunity/grease)[![Total Downloads](https://camo.githubusercontent.com/08a11dbb65b10bd9ee7b29d8673d2e4da119a0d5a7bfe8cac5f260d18f251ec7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6f6e656c6561726e696e67636f6d6d756e6974792f6772656173652e737667)](https://packagist.org/packages/onelearningcommunity/grease)[![License](https://camo.githubusercontent.com/b7ae4f5603cc4867cfb21b9b4ffb75d4f985a61ce43b0591b345af9a4b81b7df/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f6e656c6561726e696e67636f6d6d756e6974792f6772656173652e737667)](LICENSE)

**Opt-in performance for Laravel's hot paths — built from optimizations declined upstream.**

Grease speeds up the work Eloquent repeats on every request — attribute hydration, casting, serialization — with **byte-identical output** to vanilla. Add a trait to the models you care about; leave the rest untouched. Zero framework changes.

📖 **[Full documentation →](https://one-learning-community.github.io/grease/)**

Install
-------

[](#install)

```
composer require onelearningcommunity/grease
```

```
use Grease\Concerns\HasGrease;

class User extends Model
{
    use HasGrease;
}
```

That's the whole setup for the model tiers — no config, no provider, no cache to warm. The model's hydration, casting, and serialization now run the greased fast paths, and its output stays byte-identical to vanilla Eloquent. Prefer inheritance? Extend `\Grease\GreasedModel` instead.

Two further strands go beyond the model trait, each opt-in via a (non-auto-discovered) provider:

```
// bootstrap/providers.php, or the providers array in config/app.php
Grease\Events\GreaseEventServiceProvider::class,   // faster event dispatcher, app-wide
Grease\View\GreaseViewServiceProvider::class,      // faster Blade component render
```

What you get
------------

[](#what-you-get)

Representative deltas, measured on Linux ([reproduce on your own build](https://one-learning-community.github.io/grease/guide/benchmarks) — one command):

- **End-to-end requests (incl. SQL):** −78% list-100-users, −77% eager-load, −47% show, −18% bulk write.
- **Per operation:** hydrate −34%, `toArray` −47%, set+dirty −39%, read −27%, enum −48%, date serialization −87%.
- **Event dispatcher** (app-wide): −53% no-listener dispatch, ~halves a render-dense request's event overhead.
- **Blade** (Taylor's 1,000-component challenge): −38% simple / −29.5% rich, byte-identical HTML.

These are `:memory:`/Linux figures — read them as Grease's share of the work, not your p99, and reproduce on your target. The [Benchmarks guide](https://one-learning-community.github.io/grease/guide/benchmarks)has the methodology, the build-to-build variance, and the honest caveats.

Byte-identical, or it's a failing test
--------------------------------------

[](#byte-identical-or-its-a-failing-test)

That promise is the whole product. Every cast type, edge value, null, and dirty-check is asserted equal to vanilla across PHP 8.2–8.5 and Laravel 12/13; the benchmarks run the *same fixtures the parity tests prove identical*. Where Grease can't guarantee byte-identity for an exotic case, it defers to vanilla — correct, just unaccelerated.

```
composer test     # the byte-identical contract
composer bench    # phpbench per-op A/B + the SQL suite
```

Learn more
----------

[](#learn-more)

- **[Getting Started](https://one-learning-community.github.io/grease/guide/getting-started)** — install, the à-la-carte tiers, the optional providers
- **[Why Grease](https://one-learning-community.github.io/grease/guide/why)** — the "marginal in isolation" story and the declined core PRs
- **[How It Works](https://one-learning-community.github.io/grease/guide/how-it-works)** — the per-class blueprint and each tier
- **[Benchmarks](https://one-learning-community.github.io/grease/guide/benchmarks)** — full numbers, methodology, and reproducing them on your build
- **[The Event Dispatcher](https://one-learning-community.github.io/grease/guide/events)** · **[Blade Components](https://one-learning-community.github.io/grease/guide/blade)** — the two beyond-Eloquent strands
- **[Caveats &amp; Narrowing](https://one-learning-community.github.io/grease/guide/caveats)** — the two small, obscure things that change

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

[](#requirements)

PHP 8.2+, Laravel 12/13.

License
-------

[](#license)

Released under the [MIT License](LICENSE) — Copyright © 2026 One Learning Community LTD.

Built with Claude
-----------------

[](#built-with-claude)

Grease was built proudly in collaboration with [Claude](https://claude.com/claude-code)— a small proof of what a strong engineering mindset and AI can do together: measure first, keep the parity spine honest, and ship the wins core couldn't.

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance100

Actively maintained with recent releases

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

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

Total

2

Last Release

0d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5b0aa19e00a04418b0f4472c3d9020460de899517c52ead5308d0aec0ac0a49?d=identicon)[dan-onelearningcommunity](/maintainers/dan-onelearningcommunity)

---

Top Contributors

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

---

Tags

eloquentlaravellaravel-packageoptimizationormperformancephplaravelperformanceormeloquentoptimization

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/onelearningcommunity-grease/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

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

The Laravel magic applied to joins.

1.6k29.9M42](/packages/kirschbaum-development-eloquent-power-joins)[watson/validating

Eloquent model validating trait.

9733.4M53](/packages/watson-validating)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M16](/packages/reedware-laravel-relation-joins)[itpathsolutions/dbstan

Database Standardization and Analysis Tool for Laravel

442.1k](/packages/itpathsolutions-dbstan)

PHPackages © 2026

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