PHPackages                             johndivam/check-duplicate - 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. johndivam/check-duplicate

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

johndivam/check-duplicate
=========================

Check for duplicate rows based on specified columns across multiple models

v1.0(1y ago)15MITPHPPHP &gt;=8.0

Since Oct 28Pushed 1y ago1 watchersCompare

[ Source](https://github.com/johndivam/check-duplicate)[ Packagist](https://packagist.org/packages/johndivam/check-duplicate)[ RSS](/packages/johndivam-check-duplicate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

CheckDuplicates Package for Laravel
===================================

[](#checkduplicates-package-for-laravel)

The **CheckDuplicates** package is a Laravel package designed to check for duplicate rows in specified models based on configurable columns. It supports both regular and soft-deleted models and logs the results daily for easy review.

Features
--------

[](#features)

- Check for duplicate rows in one or more models.
- Supports multiple columns for duplicate checks.
- Configurable to include soft-deleted rows.
- Daily logging of duplicate checks for easy monitoring.

Installation
------------

[](#installation)

You can install the package via Composer:

```
composer require johndivam/check-duplicates
```

Configuration
-------------

[](#configuration)

Add the service provider to config/app.php under providers:

```
'providers' => [
    Johndivam\CheckDuplicate\CheckDuplicatesServiceProvider::class,
],
```

After installation, publish the configuration file:

```
php artisan vendor:publish --provider="Johndivam\CheckDuplicate\CheckDuplicatesServiceProvider"
```

This will create a configuration file at `config/check-duplicates.php`.

### Configuration Options

[](#configuration-options)

Edit the `config/check-duplicates.php` file to specify the models and columns you want to check for duplicates:

```
return [
    'models' => [
        [
            'model' => \App\Models\Task::class,
            'columns' => ['project_id', 'name'],
            'with_deletes' => false, // Set to false to exclude soft-deleted records
        ],
        [
            'model' => \App\Models\Order::class,
            'columns' => ['cart_id'],
            'with_deletes' => true, // Set to true to include soft-deleted records
        ],
        // Add more models as needed
    ],
];
```

Usage
-----

[](#usage)

The package runs a scheduled command to check for duplicates every minute. You can manually trigger the check with:

```
php artisan duplicates:check
```

You may also schedule this command in your `App\Console\Kernel.php` file to run at your desired interval:

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('duplicates:check')->everyMinute();
}
```

Logging
-------

[](#logging)

The results of the duplicate checks are logged daily in the `storage/logs/` directory. The log file is named as `check_duplicates-YYYY-MM-DD.log`, where `YYYY-MM-DD` is the date the log was created.

### Example Log Entry

[](#example-log-entry)

```
[2024-10-28 12:00:00] check_duplicates.INFO: Duplicate entries found in model App\Models\Task. Details: [{"project_id":1,"name":"Test Task"}]

```

Contributing
------------

[](#contributing)

If you would like to contribute to this package, please fork the repository and submit a pull request.

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

559d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/655dd5a6c87d2076a88c624fa9951e864b4d89f4605b0ac98311c6a2b46b1dfb?d=identicon)[johndivam](/maintainers/johndivam)

---

Top Contributors

[![johndivam](https://avatars.githubusercontent.com/u/24654964?v=4)](https://github.com/johndivam "johndivam (3 commits)")

### Embed Badge

![Health badge](/badges/johndivam-check-duplicate/health.svg)

```
[![Health](https://phpackages.com/badges/johndivam-check-duplicate/health.svg)](https://phpackages.com/packages/johndivam-check-duplicate)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M545](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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