pandawa/reloquent
Reloquent extends Laravel's Eloquent with relationship-aware query helpers, making it easier to filter, sort and eager-load related models through a fluent, chainable API. A lightweight addition for cleaner, more expressive relational queries.
v0.1.9 is a small but useful release: it adds a cache entity and ships PhpStorm generics for Collection and Repository. Both changes target day-to-day ergonomics rather than architecture, so existing code should keep working.
composer require <vendor>/<package>:^0.1.9
php artisan vendor:publish --provider="<Vendor>\<Package>\<Package>ServiceProvider" --tag=config
cache block appeared after the update.src/Entities and src/Repositories (or the package's equivalent namespaces) before writing your own. The cache entity is the reference implementation for anything you subclass.php artisan tinker that a second find() no longer hits the database.Entity + Repository pairing. Keep the established split: entities own state and hydration, repositories own querying. Don't put cache logic in the entity; put it in the repository so the caching variant is a drop-in replacement.
Caching reads through the repository. The new cache entity is meant to wrap retrieval, not to be a general-purpose cache facade:
$category = $this->categories->find($id); // cached
$this->categories->update($id, $payload); // must bust the entry
Wire it as a decorator around your existing repository rather than branching on a config flag inside every method — that keeps non-cached and cached code paths honest and testable.
Generics for editor support. The PhpStorm generics are docblock-only annotations. Use them on your own subclasses so ->all(), ->find(), and iteration resolve to your entity type instead of mixed:
/**
* @extends Repository<\App\Entities\Category>
*/
class CategoryRepository extends Repository { ... }
/** @var Collection<\App\Entities\Category> $categories */
$categories = $this->categories->all();
Replicate the pattern on any custom Collection subclass; this is where most of the everyday payoff lands, since it removes the /** @var */ noise from controllers and jobs.
Integration tips.
"^0.1.9" at most, ideally exact) and read the diff before bumping.@extends annotation will silently mislead auto-completion and static analysis — verify against the actual return types in src/.DB::table(), raw queries, seeders, or another service. Any write path that bypasses the repository must bust the key explicitly, otherwise you get stale reads that only appear after deploy.Cache::getStore() and the configured prefix, then php artisan cache:clear to prove the issue is cache-related. If results change after a flush, the bug is invalidation, not querying.Cache::store() inside the repository.How can I help you explore Laravel packages today?