anourvalar/eloquent-serialize
Serialize and restore Eloquent query builders with ease. Capture chained queries including eager loading, where clauses, and limits, then unserialize later to run them. Supports Laravel 6 through 12.
Supports: Laravel 6 - Laravel 12
composer require anourvalar/eloquent-serialize
$package = \EloquentSerialize::serialize(
\App\User::query()
->with('userPhones')
->where('id', '>', '10')
->limit(20)
);
$builder = \EloquentSerialize::unserialize($package);
foreach ($builder->get() as $item) {
// ...
}
How can I help you explore Laravel packages today?