Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Unique Violation Detector

Unique Violation Detector Laravel Package

mpyw/unique-violation-detector

Detects and normalizes unique constraint violation errors across MySQL, PostgreSQL, and SQLite. Inspects PDO exceptions and SQLSTATE codes so your PHP/Laravel app can reliably catch duplicate-key errors and handle retries or upserts without brittle driver-specific checks.

View on GitHub
Deep Wiki
Context7

mpyw/unique-violation-detector is a tiny PHP utility that tells you whether a database exception was caused by a unique constraint violation. Instead of scattering driver-specific error-code checks throughout your code, you hand it a caught exception and get a simple boolean answer.

It normalizes the quirks of MySQL, PostgreSQL, and SQLite error responses, so the same logic works across drivers and in both raw PDO and Laravel applications.

  • Driver-agnostic detection of duplicate-key errors
  • Works with PDO and Laravel query exceptions
  • No configuration or service provider required
  • Ideal for safe "insert or ignore" and retry logic
  • Zero dependencies, framework-light footprint
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package