Skip to content

GreaseGet greased.

Opt-in performance for Laravel's hot paths. One trait, byte-identical output, real requests measurably faster โ€” end to end. Built from optimizations declined upstream, packaged where you can opt in.

Grease

The whole install โ€‹

php
use Grease\Concerns\HasGrease;

class User extends Model
{
    use HasGrease; 
}

That's it. Eloquent re-derives the same class-pure facts on every attribute access and every hydrated row โ€” rebuilding the casts array, re-walking a cast switch, re-probing method_exists for mutators, re-resolving the date format, running a fresh ReflectionClass per new Model. None of it changes for the life of the class. Grease computes each fact once per class and reuses it.

Each of these was proposed to Laravel core and declined on reasonable grounds โ€” every one "marginal in isolation." Individually, maybe. Bundled, on a request that hydrates a hundred rows and serializes them to JSON, they move the number you actually pay for. Grease is where that declined work lives โ€” see the history.

Byte-identical to vanilla, or it's a failing test. ยท MIT Licensed