Model::saved(), Model::deleted()). Ideal for use cases like:
Expiry::add($model, Carbon::now()->addDays(7))), minimizing boilerplate.expiry:check), improving performance for high-volume systems.ExpiryMiddleware) to block access to expired resources.expiries, expiry_logs) may impact write performance if not indexed properly. Requires testing with production-like data volumes.Expiry::checkBatch()) be needed?travel() in Laravel) suffice, or are hardware clocks needed?TIMESTAMP precision).Expiry::cache()) to reduce DB load for frequent checks.UserSession) to validate integration and performance.mooxphp packages (e.g., moox/observer).vendor:publish).config/expiry.php (e.g., queue connection, default TTL).HasExpiry trait to models or use observers for existing models.use Moox\Expiry\Traits\HasExpiry;
class UserSession extends Model
{
use HasExpiry;
}
Expiry\Events\RecordExpired).Event::listen(RecordExpired::class, function ($model) {
// Send notification, archive data, etc.
});
expiry:check (e.g., * * * * * php artisan expiry:check --force).Expiry::check()->onQueue('expiry-checks');
mooxphp/expiry for breaking changes (e.g., Laravel version drops). Test updates in staging.Observer pattern), refactor to event listeners.expiry:list to audit active expirations.config/expiry.log_level = 'debug').expiry-checks queue for stuck jobs.expiries table (e.g., expires_at).Expiry::check()->limit(100)).Expiry::isExpired($model)->remember(60)).expiry_logs by date if retention policies require long-term storage.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Queue worker crashes | Missed expiry checks | Retry logic (Laravel’s retry-after queue). |
| Database connection drops | Expiry records not logged | Use transactions for critical expiry actions. |
| Time server desync | Incorrect expiry validation | Use application-level timestamps where possible. |
| Package bug (e.g., race condition) | Data corruption | Test with chaos engineering (e.g., kill workers). |
| High expiry volume | DB lock contention | Batch processing + read replicas. |
HasExpiry trait, events, and queue integration.expiry:list and log inspection.HasExpiry or observers.How can I help you explore Laravel packages today?