Skip to content

v0.1.0 — first release

Choose a tag to compare

@serpentblade serpentblade released this 22 Jun 05:36
· 13 commits to main since this release

First release. Opt-in performance for Laravel's hot paths, with output asserted byte-identical to vanilla Eloquent across every cast type, edge value, and dirty-check.

Install

composer require onelearningcommunity/grease
use Grease\Concerns\HasGrease;

class User extends Model
{
    use HasGrease;
}

What's in it

Four composable per-model tiers over a single lazily-built, per-class blueprint (HasGrease, or the GreasedModel base class):

  • HasGreasedHydration — removes the per-row ReflectionClass, the per-instance casts rebuild, and newInstance's redundant work during hydration.
  • HasGreasedAttributes — memoizes getCasts / getCastType / getDates / mutator probes / getDateFormat; a divergence guard keeps runtime mergeCasts() / withCasts() correct.
  • HasGreasedCasts — flyweight cast dispatch replacing the per-access switch, an enum fast path that delegates conversion to the framework, and synonym-cast flyweight dedup.
  • HasGreasedSerialization — eliminates the Carbon parse-and-reformat round-trip for date serialization when a per-class probe certifies a byte-identical rewrite; defers to vanilla otherwise.

Grease\Events\Dispatcher — a drop-in, behaviour-identical faster event dispatcher (no-listener fast path, cached listener resolution, pre-compiled wildcard patterns), opt-in via GreaseEventServiceProvider. Speeds up every dispatch app-wide, not just model events.

Requirements

PHP 8.2+ · Laravel 12 / 13

Links

📖 Documentation · 📋 Changelog

Built proudly with Claude.