PHPackages                             mpyw/laravel-unique-violation-detector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. mpyw/laravel-unique-violation-detector

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

mpyw/laravel-unique-violation-detector
======================================

Detect primary/unique key or constraint violation errors from PDOException.

v1.1.3(2y ago)262.6k↓29.4%1MITPHPPHP ^8.0

Since Nov 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mpyw/laravel-unique-violation-detector)[ Packagist](https://packagist.org/packages/mpyw/laravel-unique-violation-detector)[ RSS](/packages/mpyw-laravel-unique-violation-detector/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (6)Dependencies (7)Versions (8)Used By (1)

Laravel Unique Violation Detector [![Build Status](https://github.com/mpyw/laravel-unique-violation-detector/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/laravel-unique-violation-detector/actions) [![Coverage Status](https://camo.githubusercontent.com/57982542a777ed3805e1abd7cfa06eff4157e38ed78a35c0edb4492f906e3052/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6d7079772f6c61726176656c2d756e697175652d76696f6c6174696f6e2d6465746563746f722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/mpyw/laravel-unique-violation-detector?branch=master)
===============================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#laravel-unique-violation-detector--)

Caution

**ABANDONED: The functionalities of this library have been integrated into the Laravel core due to changes in Laravel [v10.20.0](https://github.com/laravel/framework/releases/tag/v10.20.0). From now on, the `Illuminate\Database\UniqueConstraintViolationException` exception class will be thrown when there is a unique constraint violation, so there is no need to use this library for judgment. Simply checking with `catch` or `instanceof` should be sufficient. Although the internal judgment logic is strictly different in some parts, it should be replaceable without any problems in most cases.**

Detect **primary/unique key or constraint violation** errors from `PDOException`.

Requirements
------------

[](#requirements)

PackageVersionPHP`^8.0`Laravel`^9.0 || ^10.0`[mpyw/unique-violation-detector](https://github.com/mpyw/unique-violation-detector)`^1.0`Supported Connections
---------------------

[](#supported-connections)

DatabaseConnection ClassMySQL`Illuminate\Database\MySqlConnection`PostgreSQL`Illuminate\Database\PostgresConnection`SQLite`Illuminate\Database\SQLiteConnection`SQLServer`Illuminate\Database\SqlServerConnection`You can also add custom resolvers by one of the following:

- `Mpyw\LaravelUniqueViolationDetector\Facades\Unique::resolverFor()`
- `Mpyw\LaravelUniqueViolationDetector\DetectorDiscoverer::resolverFor()`

Installing
----------

[](#installing)

```
composer require mpyw/laravel-unique-violation-detector

```

Usage
-----

[](#usage)

You can detect unique violations in various ways.

```
use Mpyw\LaravelUniqueViolationDetector\UniqueViolationDetector;
use Mpyw\LaravelUniqueViolationDetector\Facades\Unique;

// Detect on a specific connection via explicitly created detector instance
// (Recommended usage in libraries)
$violated = (new UniqueViolationDetector($connection))->violated($e);

// Detect on the default connection
$violated = Unique::violated($exception);

// Detect on a specific connection via Facade
$violated = Unique::forConnection($connection)->violated($e);
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~105 days

Recently: every ~158 days

Total

7

Last Release

1000d ago

PHP version history (2 changes)v1.0.0PHP ^7.3 || ^8.0

v1.1.2PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1351893?v=4)[mpyw](/maintainers/mpyw)[@mpyw](https://github.com/mpyw)

---

Top Contributors

[![mpyw](https://avatars.githubusercontent.com/u/1351893?v=4)](https://github.com/mpyw "mpyw (9 commits)")

---

Tags

laraveldatabaseduplicateilluminateconstraint

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpyw-laravel-unique-violation-detector/health.svg)

```
[![Health](https://phpackages.com/badges/mpyw-laravel-unique-violation-detector/health.svg)](https://phpackages.com/packages/mpyw-laravel-unique-violation-detector)
```

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[mpyw/laravel-cached-database-stickiness

Guarantee database stickiness over the same user's consecutive requests

83316.8k](/packages/mpyw-laravel-cached-database-stickiness)[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
