---
title: "Artisan commands — Imports for Laravel | Roundly"
description: "imports:sweep, prune, doctor, importers, template and install — what each does, the doctor’s checks, scheduling and the facade equivalents."
url: https://roundly-consulting.com/open-source/docs/imports-for-laravel/commands
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Imports for Laravel](https://roundly-consulting.com/open-source/docs/imports-for-laravel.md)

# Artisan commands

| Command | Does |
| --- | --- |
| `imports:sweep` | Expires sessions past sessions.expire\_after (file deleted), fails lost validations (preview\_failed, abandoned) and stuck commits and rollbacks, releases their lock and cancels their job batch, removes temp directories older than storage.tmp\_ttl. One session’s error is reported and the sweep carries on; a session whose owner was deleted is closed without its event. |
| `imports:prune` | Deletes source files, working copies and row results older than storage.retention; with history.retention also sessions, batches and ledger rows past it and past their undo window. Fires ImportsPruned. |
| `imports:doctor` | The setup checks below; exits non-zero on an error. |
| `imports:importers` | A table of importers: key, label, kind, fields, modes, formats. |
| `imports:template {importer} {--format=xlsx} {--locale=} {--output=}` | Writes a template file — --format xlsx or csv (else exit 1); default output ./<label-slug>.<ext>. |
| `imports:install` | Publishes the config, the migrations and options-for-laravel’s migration (unless its table exists) and prints the next steps; exit 1 when the imports tables exist. |

```bash
php artisan imports:sweep
# Expired N session(s), failed N stuck preview(s), N commit(s) and N rollback(s), removed N temp directory(ies).

php artisan imports:prune      # prints the PruneReport counts and fires ImportsPruned
```

## Scheduling

Nothing is scheduled automatically:

```php
// routes/console.php
use Illuminate\Support\Facades\Schedule;

Schedule::command('imports:sweep')->everyFiveMinutes()->withoutOverlapping(10)->onOneServer();
Schedule::command('imports:prune')->daily()->onOneServer();
```

## From PHP

```php
$report = Imports::sweep();   // SweepReport: expired, failedCommits, failedRollbacks, tempDirectories, failedPreviews
$report = Imports::prune();   // PruneReport: files, rowResults, sessions, batches, records
```

## What the doctor checks

One finding per check — ok and info green, warning yellow, error red; each is a DoctorFinding (check, level, message):

| Check | Error / warning when |
| --- | --- |
| `importers` | An importer is invalid (error); none registered (warning). |
| `key_type` | imports.key\_type differs from options.key\_type (error). |
| `job_batches` | Laravel’s job\_batches table is missing (error). |
| `queue` | The import queue is the sync driver (warning). |
| `retry_after` | The queue connection’s retry\_after is not above imports.commit.timeout (error). |
| `disk` | The disk is not configured or is public (error). |
| `retention` | storage.retention is shorter than undo.window (warning: a failed import cannot be resumed once its file is pruned). |
| `extensions` | zip, xmlreader, xmlwriter or mbstring is missing (error). |
| `lock_store` | mappings.lock\_store is not shared between servers (warning). |
| `owner_scope` | The class is invalid (error); teams-for-laravel is installed but the default scope is used (warning). |
| `options_table` | Missing while saved mappings are on (error); info when they are off. |
| `migrations` | The imports tables are missing (error). |

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/imports-for-laravel.md)
