mpyw / unique-violation-detector
Detect primary/unique key or constraint violation errors from PDOException.
Installs: 57 593
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: ^7.1 || ^8.0
- ext-pdo: *
Requires (Dev)
- phpunit/phpunit: >=7.0
This package is auto-updated.
Last update: 2024-11-13 08:33:26 UTC
README
Detect primary/unique key or constraint violation errors from PDOException
.
Installing
composer require mpyw/unique-violation-detector
Requirements
Supported PDO Drivers
Usage
use Mpyw\UniqueViolationDetector\MySQLDetector; // Explicitly instantiate a detector $violated = (new MySQLDetector())->uniqueConstraintViolated($exception);
use Mpyw\UniqueViolationDetector\DetectorDiscoverer; // Discover a detector from a PDO instance // (Not available for pdo_odbc and pdo_dblib) $violated = (new DetectorDiscoverer()) ->discover($pdo) ->uniqueConstraintViolated($exception);