NewWe open-sourced 50+ Laravel packages
Custom AI apps, agents and automation — Roundly ConsultingRoundly
All packages

All events are final readonly and dispatched after the surrounding transaction commits (ShouldDispatchAfterCommit). Unless noted, each carries $audit — an ImportAudit with sessionId, batchId, importer, owner, the actor of that operation (uploader, committer or the user who undid it), the file (a FileReference: disk, path, originalName, size, sha256, format), counts and at.

EventExtra payloadWhen
ImportUploaded · ImportMapped · ImportPreviewed—A file was uploaded, mapped, previewed.
ImportPreviewProgressedprocessed, totalEvery preview.progress_every rows.
ImportPreviewFailedreasonThe error message (≤ 500 characters), or abandoned when imports:sweep released a lost validation.
ImportStarted—Just before the dispatch; a refused dispatch follows it with ImportFailed (dispatch_failed).
ImportChunkProcessedchunk, rows, summaryAfter each chunk — running totals.
ImportCompletedsummaryThe batch finished.
ImportFailedreason, summarychunk_failed, unauthorized, abandoned or dispatch_failed — resumable.
ImportCancelled · ImportResumed—A batch was cancelled or resumed.
ImportRollbackStarted—An undo started.
ImportRolledBackreportThe undo finished — a RollbackReport.
ImportRollbackFailedreasonchunk_failed or abandoned — can be started again inside the undo window.
ImportDiscarded · ImportExpired—A session was discarded, or expired by imports:sweep.
MappingSavedowner, actor, importer, mapping, sessionIdNo audit. sessionId is null when saved by host code through mappings()->save().
MappingDeletedowner, actor, importer, nameNo audit.
ImportsPrunedreportA PruneReport, no audit.

Listeners of a batch’s ImportCompleted and ImportFailed run inside the owner’s context. A session whose owner was deleted is still closed by housekeeping — failed, its undo finished or expired, its lock released — but fires no event, because the audit names the owner.

use Illuminate\Support\Facades\Event;
use RoundlyConsulting\Imports\Events\ImportCompleted;

Event::listen(function (ImportCompleted $event): void {
    $event->audit->actor?->notify(new ImportFinished(
        importer: $event->audit->importer,
        file: $event->audit->file->originalName,
        created: $event->summary->created,
        failed: $event->summary->failed,
    ));
});

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

By 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.