PHPackages                             mozex/laravel-scout-bulk-actions - 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. mozex/laravel-scout-bulk-actions

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

mozex/laravel-scout-bulk-actions
================================

Import, flush, and queue-import all your Laravel Scout searchable models at once. Auto-discovers models, runs in bulk, tracks progress.

1.7.0(2mo ago)1539.3k↓53.1%[1 PRs](https://github.com/mozex/laravel-scout-bulk-actions/pulls)MITPHPPHP ^8.2.0CI passing

Since Jun 29Pushed 3w ago1 watchersCompare

[ Source](https://github.com/mozex/laravel-scout-bulk-actions)[ Packagist](https://packagist.org/packages/mozex/laravel-scout-bulk-actions)[ Docs](https://github.com/mozex/laravel-scout-bulk-actions)[ GitHub Sponsors](https://github.com/mozex)[ RSS](/packages/mozex-laravel-scout-bulk-actions/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (10)Dependencies (30)Versions (20)Used By (0)

Laravel Scout Bulk Actions
==========================

[](#laravel-scout-bulk-actions)

[![Latest Version on Packagist](https://camo.githubusercontent.com/1f5bf268e989b1131641debcdf46fd21dbe6876d99b7788dca4ed35a7b78636a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f7a65782f6c61726176656c2d73636f75742d62756c6b2d616374696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-scout-bulk-actions)[![GitHub Checks Workflow Status](https://camo.githubusercontent.com/781a2310b55ad040617210d72b47d55087998da1c4b75b8c098b59b561778bb4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f7a65782f6c61726176656c2d73636f75742d62756c6b2d616374696f6e732f636865636b732e796d6c3f6272616e63683d6d61696e266c6162656c3d636865636b73267374796c653d666c61742d737175617265)](https://github.com/mozex/laravel-scout-bulk-actions/actions/workflows/checks.yml)[![Docs](https://camo.githubusercontent.com/6bae6cab4895bc9b3768db4e7f44e2640da7b03da9635f43f34a1ea306f23e0e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f63732d6d6f7a65782e6465762d3130423938313f7374796c653d666c61742d737175617265)](https://mozex.dev/docs/laravel-scout-bulk-actions/v1)[![License](https://camo.githubusercontent.com/f241ea2dcfa7c363df8df3645f057e6efb59160af717dbf85ce89936971e45bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6f7a65782f6c61726176656c2d73636f75742d62756c6b2d616374696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-scout-bulk-actions)[![Total Downloads](https://camo.githubusercontent.com/41c81e6adee27707d0cf27d6085fe902703a927d6a1c1089133c4361d4849721/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f7a65782f6c61726176656c2d73636f75742d62756c6b2d616374696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mozex/laravel-scout-bulk-actions)

Laravel Scout's built-in commands work on one model at a time. If your project has ten searchable models, that's ten separate `scout:import` calls every time you need to rebuild your indexes. This package fixes that.

Scout Bulk Actions auto-discovers every model that uses the `Searchable` trait and lets you import, flush, or refresh all of them with a single command. It also supports queued bulk imports for projects where synchronous indexing is too slow.

> **[Read the full documentation at mozex.dev](https://mozex.dev/docs/laravel-scout-bulk-actions/v1)**: searchable docs, version requirements, detailed changelog, and more.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Configuration](#configuration)
- [Commands](#commands)
    - [scout:import-all](#scoutimport-all)
    - [scout:flush-all](#scoutflush-all)
    - [scout:queue-import-all](#scoutqueue-import-all)
    - [scout:refresh](#scoutrefresh)
    - [Production Safety](#production-safety)
- [How It Works](#how-it-works)

Support This Project
--------------------

[](#support-this-project)

I maintain this package along with [several other open-source PHP packages](https://mozex.dev/docs) used by thousands of developers every day.

If my packages save you time or help your business, consider [**sponsoring my work on GitHub Sponsors**](https://github.com/sponsors/mozex). Your support lets me keep these packages updated, respond to issues quickly, and ship new features.

Business sponsors get logo placement in package READMEs. [**See sponsorship tiers →**](https://github.com/sponsors/mozex)

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

[](#installation)

> **Requires [PHP 8.2+](https://php.net/releases/)** - see [all version requirements](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/requirements)

Install the package via Composer:

```
composer require mozex/laravel-scout-bulk-actions
```

That's it. The package auto-registers its service provider via Laravel's package discovery.

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

[](#configuration)

Publish the config file:

```
php artisan vendor:publish --tag="scout-bulk-actions-config"
```

This creates `config/scout-bulk-actions.php`:

```
return [
    'model_directories' => [
        app_path('Models'),
        // base_path('Modules/*/Models'),
    ],
];
```

The `model_directories` array tells the package where to look for your searchable models. By default it scans `app/Models`, which covers most Laravel projects.

Glob patterns work here too. If you're using a modular architecture, something like `base_path('Modules/*/Models')` will scan the `Models` directory inside every module at once.

After changing the config in production, run `php artisan config:clear` to pick up the new values.

Commands
--------

[](#commands)

### `scout:import-all`

[](#scoutimport-all)

Imports all discovered searchable models into the search index:

```
php artisan scout:import-all
```

You can control the chunk size (how many records are sent per batch) with the `--chunk` option:

```
php artisan scout:import-all --chunk=200
```

If omitted, it falls back to the `scout.chunk.searchable` config value.

### `scout:flush-all`

[](#scoutflush-all)

Removes all records from the search index for every discovered model:

```
php artisan scout:flush-all
```

### `scout:queue-import-all`

[](#scoutqueue-import-all)

For large datasets, synchronous imports can be slow. This command dispatches queued jobs that split each model's records into chunks by ID range, the same approach Scout's native `scout:queue-import` uses, but applied across all your models at once:

```
php artisan scout:queue-import-all
```

Options:

```
# Set the chunk size per job
php artisan scout:queue-import-all --chunk=500

# Specify which queue to dispatch jobs to
php artisan scout:queue-import-all --queue=indexing
```

This is the fastest way to rebuild indexes for projects with many models and millions of rows.

### `scout:refresh`

[](#scoutrefresh)

Flushes then imports, in one step. Useful when you need a clean re-index:

```
php artisan scout:refresh
```

You can also target a single model:

```
php artisan scout:refresh "App\Models\Post"
```

When no model is specified, it runs `scout:flush-all` followed by `scout:import-all` under the hood. The `--chunk` option works here too.

### Production Safety

[](#production-safety)

All commands ask for confirmation when `APP_ENV` is `production`. To skip the prompt (for CI pipelines or automated scripts), pass `--force`:

```
php artisan scout:import-all --force
php artisan scout:flush-all --force
php artisan scout:queue-import-all --force
php artisan scout:refresh --force
```

How It Works
------------

[](#how-it-works)

The package scans the directories you've configured using Symfony's Finder component. For each PHP file it finds, it:

1. Converts the file path to a fully qualified class name.
2. Checks via Reflection that the class is a concrete (non-abstract) Eloquent model.
3. Verifies the class uses Laravel Scout's `Searchable` trait.

Models that pass all three checks are collected, and the chosen Scout command (`scout:import`, `scout:flush`, or `scout:queue-import`) runs against each one. A progress bar tracks the operation so you can see where things stand.

If any single model fails during the operation, the command stops immediately and returns a failure exit code.

Resources
---------

[](#resources)

Visit the [documentation site](https://mozex.dev/docs/laravel-scout-bulk-actions/v1) for searchable docs auto-updated from this repository.

- **[AI Integration](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/ai-integration)**: Use this package with AI coding assistants via Context7 and Laravel Boost
- **[Requirements](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/requirements)**: PHP, Laravel, and dependency versions
- **[Changelog](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/changelog)**: Release history with linked pull requests and diffs
- **[Contributing](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/contributing)**: Development setup, code quality, and PR guidelines
- **[Questions &amp; Issues](https://mozex.dev/docs/laravel-scout-bulk-actions/v1/questions-and-issues)**: Bug reports, feature requests, and help
- **[Security](mailto:hello@mozex.dev)**: Report vulnerabilities directly via email

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance91

Actively maintained with recent releases

Popularity36

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 85.3% 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 ~64 days

Recently: every ~6 days

Total

17

Last Release

73d ago

PHP version history (3 changes)1.0.0PHP ^8.1

1.3.0PHP ^8.1.0

1.3.1PHP ^8.2.0

### Community

Maintainers

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

---

Top Contributors

[![mozex](https://avatars.githubusercontent.com/u/18025667?v=4)](https://github.com/mozex "mozex (116 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (14 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

artisanbulk-importeloquentindexinglaravellaravel-scoutphpqueue-importreindexscoutsearchsearchlaravelreindexeloquentartisanqueueimportsearchableindexingscoutbulkflushbulk-importqueue-import

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mozex-laravel-scout-bulk-actions/health.svg)

```
[![Health](https://phpackages.com/badges/mozex-laravel-scout-bulk-actions/health.svg)](https://phpackages.com/packages/mozex-laravel-scout-bulk-actions)
```

###  Alternatives

[laravel/octane

Supercharge your Laravel application's performance.

4.0k26.6M223](/packages/laravel-octane)[statamic/cms

The Statamic CMS Core Package

4.8k3.6M992](/packages/statamic-cms)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11223.5M33](/packages/anourvalar-eloquent-serialize)[wnx/laravel-backup-restore

A package to restore database backups made with spatie/laravel-backup.

213421.2k2](/packages/wnx-laravel-backup-restore)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.4k](/packages/typicms-base)[lacodix/laravel-model-filter

A Laravel package to filter, search and sort models with ease while fetching from database.

17558.6k](/packages/lacodix-laravel-model-filter)

PHPackages © 2026

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