All packages
Imports for Laravel
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. |
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 ImportsPrunedScheduling
Nothing is scheduled automatically:
// routes/console.php
use Illuminate\Support\Facades\Schedule;
Schedule::command('imports:sweep')->everyFiveMinutes()->withoutOverlapping(10)->onOneServer();
Schedule::command('imports:prune')->daily()->onOneServer();From PHP
$report = Imports::sweep(); // SweepReport: expired, failedCommits, failedRollbacks, tempDirectories, failedPreviews
$report = Imports::prune(); // PruneReport: files, rowResults, sessions, batches, recordsWhat 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 cryptoBy donating, you agree to our donation terms.
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.