mpyw/laravel-retry-on-duplicate-key
Automatically retries database operations when a duplicate key error occurs in Laravel. Wrap Eloquent firstOrCreate, updateOrCreate, or insert calls in a retryable transaction to safely handle race conditions and unique constraint conflicts under concurrent writes.
updateOrCreate/firstOrCreate. It addresses a real race condition but sits as a persistence-layer workaround, not a strategic architecture component. Best fit is an existing Laravel app with observed duplicate-key races and no near-term path to database-native atomic upserts.upsert, insertOrIgnore, or database-specific ON CONFLICT handling where available. If adopted, isolate it behind a repository or dedicated persistence service rather than applying it broadly.How can I help you explore Laravel packages today?