{"id":43906248,"url":"https://github.com/mavinoo/laravelBatch","last_synced_at":"2026-02-18T13:00:36.415Z","repository":{"id":25704858,"uuid":"106090089","full_name":"mavinoo/laravelBatch","owner":"mavinoo","description":"insert batch and update batch in laravel","archived":false,"fork":false,"pushed_at":"2026-01-08T07:37:42.000Z","size":130,"stargazers_count":592,"open_issues_count":16,"forks_count":124,"subscribers_count":5,"default_branch":"master","last_synced_at":"2026-01-11T18:27:39.739Z","etag":null,"topics":["batch","batch-insert","batch-update","laravel","laravelbatch","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mavinoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-07T10:41:01.000Z","updated_at":"2026-01-08T07:37:46.000Z","dependencies_parsed_at":"2024-06-18T12:26:55.349Z","dependency_job_id":null,"html_url":"https://github.com/mavinoo/laravelBatch","commit_stats":{"total_commits":123,"total_committers":33,"mean_commits":3.727272727272727,"dds":0.5934959349593496,"last_synced_commit":"3fc44da87d0785f67e1a3eb15a034d6b82e2a58f"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/mavinoo/laravelBatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mavinoo%2FlaravelBatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mavinoo%2FlaravelBatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mavinoo%2FlaravelBatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mavinoo%2FlaravelBatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mavinoo","download_url":"https://codeload.github.com/mavinoo/laravelBatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mavinoo%2FlaravelBatch/sbom","scorecard":{"id":628702,"data":{"date":"2025-08-11","repo":{"name":"github.com/mavinoo/laravelBatch","commit":"77f8f02d20ce2a3c78da7e395762d6bd825fca12"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.7,"checks":[{"name":"Code-Review","score":5,"reason":"Found 10/19 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 21 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T07:14:13.903Z","repository_id":25704858,"created_at":"2025-08-21T07:14:13.903Z","updated_at":"2025-08-21T07:14:13.903Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29580622,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T08:38:15.585Z","status":"ssl_error","status_checked_at":"2026-02-18T08:38:14.917Z","response_time":162,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","batch-insert","batch-update","laravel","laravelbatch","php"],"created_at":"2026-02-06T20:00:20.121Z","updated_at":"2026-02-18T13:00:36.401Z","avatar_url":"https://github.com/mavinoo.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Laravel BATCH (BULK)\n\nInsert and update batch (bulk) in laravel\n\n[![License](https://poser.pugx.org/mavinoo/laravel-batch/license)](https://packagist.org/packages/mavinoo/laravel-batch)\n[![Latest Stable Version](https://poser.pugx.org/mavinoo/laravel-batch/v/stable)](https://packagist.org/packages/mavinoo/laravel-batch)\n[![Total Downloads](https://poser.pugx.org/mavinoo/laravel-batch/downloads)](https://packagist.org/packages/mavinoo/laravel-batch)\n[![Daily Downloads](https://poser.pugx.org/mavinoo/laravel-batch/d/daily)](https://packagist.org/packages/mavinoo/laravel-batch)\n\n# Install\n\n`composer require mavinoo/laravel-batch`\n\n# Service Provider\n\nFile `app.php` in array providers:\n\n`Mavinoo\\Batch\\BatchServiceProvider::class,`\n\n# Aliases\n\nFile `app.php` in array aliases:\n\n`'Batch' =\u003e Mavinoo\\Batch\\BatchFacade::class,`\n\n# Example Update Multiple Condition\n\n```php\nuse App\\Models\\User;\n\n$userInstance = new User;\n$arrays = [\n    [\n        'conditions' =\u003e ['id' =\u003e 1, 'status' =\u003e 'active'],\n        'columns'    =\u003e [\n            'status' =\u003e 'invalid',\n            'nickname' =\u003e 'mohammad',\n        ],\n    ],\n    [\n        'conditions' =\u003e ['id' =\u003e 2],\n        'columns'    =\u003e [\n            'nickname' =\u003e 'mavinoo',\n            'name' =\u003e 'mohammad',\n        ],\n    ],\n    [\n        'conditions' =\u003e ['id' =\u003e 3],\n        'columns'    =\u003e [\n            'nickname' =\u003e 'ali',\n        ],\n    ],\n];\n$keyName = 'id';\n\nBatch::updateMultipleCondition($userInstance, $arrays, $keyName);\n// or\nbatch()-\u003eupdateMultipleCondition($userInstance, $arrays, $keyName);\n```\n\n# Example Update 2\n\n```php\nuse App\\Models\\User;\n\n$userInstance = new User;\n$value = [\n    [\n        'id' =\u003e 1,\n        'status' =\u003e 'active',\n        'nickname' =\u003e 'Mohammad',\n    ],\n    [\n        'id' =\u003e 5,\n        'status' =\u003e 'deactive',\n        'nickname' =\u003e 'Ghanbari',\n    ],\n];\n$index = 'id';\n\nBatch::update($userInstance, $value, $index);\n// or\nbatch()-\u003eupdate($userInstance, $values, $index);\n```\n\n# Example Update 3\n\n```php\nuse App\\Models\\User;\n\n$userInstance = new User;\n$value = [\n    [\n        'id' =\u003e 1,\n        'status' =\u003e 'active',\n    ],\n    [\n        'id' =\u003e 5,\n        'status' =\u003e 'deactive',\n        'nickname' =\u003e 'Ghanbari',\n    ],\n    [\n        'id' =\u003e 10,\n        'status' =\u003e 'active',\n        'date' =\u003e Carbon::now(),\n    ],\n    [\n        'id' =\u003e 11,\n        'username' =\u003e 'mavinoo',\n    ],\n];\n$index = 'id';\n\nBatch::update($userInstance, $value, $index);\n// or\nbatch()-\u003eupdate($userInstance, $values, $index);\n```\n\n# Example Increment / Decrement\n\n```php\nuse App\\Models\\User;\n\n$userInstance = new User;\n$value = [\n    [\n        'id' =\u003e 1,\n        'balance' =\u003e ['+', 500], // Add\n    ],\n    [\n        'id' =\u003e 2,\n        'balance' =\u003e ['-', 200], // Subtract\n    ],\n    [\n        'id' =\u003e 3,\n        'balance' =\u003e ['*', 5], // Multiply\n    ],\n    [\n        'id' =\u003e 4,\n        'balance' =\u003e ['/', 2], // Divide\n    ],\n    [\n        'id' =\u003e 5,\n        'balance' =\u003e ['%', 2], // Modulo\n    ],\n];\n$index = 'id';\n\nBatch::update($userInstance, $value, $index);\n// or\nbatch()-\u003eupdate($userInstance, $values, $index);\n```\n\n# Example Insert\n\n```php\nuse App\\Models\\User;\n\n$userInstance = new User;\n$columns = [\n    'firstName',\n    'lastName',\n    'email',\n    'isActive',\n    'status',\n];\n$values = [\n    [\n        'Mohammad',\n        'Ghanbari',\n        'emailSample_1@gmail.com',\n        '1',\n        '0',\n    ],\n    [\n        'Saeed',\n        'Mohammadi',\n        'emailSample_2@gmail.com',\n        '1',\n        '0',\n    ],\n    [\n        'Avin',\n        'Ghanbari',\n        'emailSample_3@gmail.com',\n        '1',\n        '0',\n    ],\n];\n$batchSize = 500; // insert 500 (default), 100 minimum rows in one query\n\n$result = Batch::insert($userInstance, $columns, $values, $batchSize);\n// or\n$result = batch()-\u003einsert($userInstance, $values, $index);\n```\n\n```php\n// result: false or array\n\nsample array result:\nArray\n(\n    [totalRows]  =\u003e 384\n    [totalBatch] =\u003e 500\n    [totalQuery] =\u003e 1\n)\n```\n\n# Example called from model\n\nAdd `HasBatch` trait into model:\n\n```php\nnamespace App\\Models;\n\nuse Mavinoo\\Batch\\Traits\\HasBatch;\n\nclass User extends Model\n{\n    use HasBatch;\n}\n```\n\nAnd call `batchUpdate()` or `batchInsert()` from model:\n\n```php\nuse App\\Models\\User;\n\n// ex: update\nUser::batchUpdate($value, $index);\n\n// ex: insert\nUser::batchInsert($columns, $values, $batchSize);\n```\n\n# Helper batch()\n\n```php\n// ex: update\n$result = batch()-\u003eupdate($userInstance, $value, $index);\n\n\n// ex: insert\n$result = batch()-\u003einsert($userInstance, $columns, $values, $batchSize);\n```\n\n# Tests\n\nIf you don't have phpunit installed on your project, first run `composer require phpunit/phpunit`\n\nIn the root of your laravel app, run `./vendor/bin/phpunit ./vendor/mavinoo/laravel-batch/tests`\n\n# Donate\n\nUSDT Address: 0x98410956169cdd00a43fe895303bdca096f37062\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmavinoo%2FlaravelBatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmavinoo%2FlaravelBatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmavinoo%2FlaravelBatch/lists"}