PHPackages                             quangpv/fast-bulk-update - 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. quangpv/fast-bulk-update

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

quangpv/fast-bulk-update
========================

fast bulk update in laravel

v1.0.1(2y ago)08MITPHPPHP ^7.3|^8.0

Since Nov 10Pushed 2y ago1 watchersCompare

[ Source](https://github.com/quanggpv/fast-batch-update)[ Packagist](https://packagist.org/packages/quangpv/fast-bulk-update)[ RSS](/packages/quangpv-fast-bulk-update/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

This package currently supports bulk updates in MySQL, MariaDB, and PostgreSQL, and it is compatible with Laravel version 8 and above

✔️ supports MySql
✔️ supports MariaDB
✔️ supports PostgreSQL

Laravel fast bulk update
========================

[](#laravel-fast-bulk-update)

[![Latest Stable Version](https://camo.githubusercontent.com/c43a496d9ac0c0fce1f8402f8da9e2d6a27b113cbd001a45052f9fea09c90a33/687474703a2f2f706f7365722e707567782e6f72672f7175616e6770762f666173742d62756c6b2d7570646174652f76)](https://packagist.org/packages/quangpv/fast-bulk-update)[![Total Downloads](https://camo.githubusercontent.com/20d387103c9e38a90b5b59785b91be6d7423677d5dcf21fa2146d7b96dce2db6/687474703a2f2f706f7365722e707567782e6f72672f7175616e6770762f666173742d62756c6b2d7570646174652f646f776e6c6f616473)](https://packagist.org/packages/quangpv/fast-bulk-update)[![Latest Unstable Version](https://camo.githubusercontent.com/d2b8ecaf34456df23f772f39673b8891a67b8e78ec1e80ddb42e5300ae132cc6/687474703a2f2f706f7365722e707567782e6f72672f7175616e6770762f666173742d62756c6b2d7570646174652f762f756e737461626c65)](https://packagist.org/packages/quangpv/fast-bulk-update)[![License](https://camo.githubusercontent.com/3edf9558102bc655a3747ab410b40ef74e0b3717c7be5fd846443e489f10192b/687474703a2f2f706f7365722e707567782e6f72672f7175616e6770762f666173742d62756c6b2d7570646174652f6c6963656e7365)](https://packagist.org/packages/quangpv/fast-bulk-update)[![PHP Version Require](https://camo.githubusercontent.com/dbe43c23a184fefb68857b91693313a4ba8e11c4b08ec22cd37bc7c759b2ad75/687474703a2f2f706f7365722e707567782e6f72672f7175616e6770762f666173742d62756c6b2d7570646174652f726571756972652f706870)](https://packagist.org/packages/quangpv/fast-bulk-update)

Install
=======

[](#install)

```
composer require quangpv/fast-bulk-update

```

Example Usage
=============

[](#example-usage)

```
use App\Models\User;

$model = App::make(User::class);

// If you wish to modify the database connection, you can set it on your model.
$model->setConnection('mariadb');
$model->setConnection('mysql');
$model->setConnection('pgsql');

$values = [
     [
         'id' => 1,
         'code' => 'UC01',
         'nickname' => 'quangpv'
     ] ,
     [
         'id' => 2,
         'code' => 'UC02',
         'nickname' => 'haiza'
     ] ,
];

// We will find the records by their IDs and update them.
$indexes = ['id']; // primary key
// $indexes = ['code', 'id']; // composite primary key

$updateFields = ['nickname']; // only update the field `nickname`
// $updateFields = []; // update all fields

$affectedRows = \BatchUpdate::execute($model, $values, $indexes, $updateFields);
```

Warning

Ensure that the indexes match the primary key in your table, because the MySQL database driver always uses the "primary" and "unique" indexes of the table to detect existing records.

Other option
============

[](#other-option)

If you wanna update on fields that are not primary or unique indexes, you can refer to my approach here
.

My idea
=======

[](#my-idea)

The basic update queries will use the 'INSERT...ON DUPLICATE KEY UPDATE...' statement in MYSQL.

I took inspiration from Laravel's 'upsert' function, but removed the 'insert' functionality. I believe the built-in function of MySQL has an excellent data structure for updating

Important

If this package has been helpful to you, please give me a star. Thank you! :D

References
==========

[](#references)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Every ~140 days

Total

2

Last Release

770d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c2998f7a032b1aecc48e573c7e34c6753c80d14b026a9f4aeee863865a2a8c84?d=identicon)[quangpv](/maintainers/quangpv)

---

Top Contributors

[![quanggpv](https://avatars.githubusercontent.com/u/36328832?v=4)](https://github.com/quanggpv "quanggpv (8 commits)")

### Embed Badge

![Health badge](/badges/quangpv-fast-bulk-update/health.svg)

```
[![Health](https://phpackages.com/badges/quangpv-fast-bulk-update/health.svg)](https://phpackages.com/packages/quangpv-fast-bulk-update)
```

###  Alternatives

[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[abbasudo/laravel-purity

elegant way to add filter and sort in laravel

514330.5k1](/packages/abbasudo-laravel-purity)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135192.6k5](/packages/statamic-rad-pack-runway)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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