---
title: "Events — Imports for Laravel | Roundly"
description: "Every event the package dispatches after the commit — upload, mapping, preview, start, chunks, completion, failure, cancel, resume, undo, cleanup."
url: https://roundly-consulting.com/open-source/docs/imports-for-laravel/events
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)

# Events

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.

| Event | Extra payload | When |
| --- | --- | --- |
| `ImportUploaded · ImportMapped · ImportPreviewed` | — | A file was uploaded, mapped, previewed. |
| `ImportPreviewProgressed` | processed, total | Every preview.progress\_every rows. |
| `ImportPreviewFailed` | reason | The 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). |
| `ImportChunkProcessed` | chunk, rows, summary | After each chunk — running totals. |
| `ImportCompleted` | summary | The batch finished. |
| `ImportFailed` | reason, summary | chunk\_failed, unauthorized, abandoned or dispatch\_failed — resumable. |
| `ImportCancelled · ImportResumed` | — | A batch was cancelled or resumed. |
| `ImportRollbackStarted` | — | An undo started. |
| `ImportRolledBack` | report | The undo finished — a RollbackReport. |
| `ImportRollbackFailed` | reason | chunk\_failed or abandoned — can be started again inside the undo window. |
| `ImportDiscarded · ImportExpired` | — | A session was discarded, or expired by imports:sweep. |
| `MappingSaved` | owner, actor, importer, mapping, sessionId | No audit. sessionId is null when saved by host code through mappings()->save(). |
| `MappingDeleted` | owner, actor, importer, name | No audit. |
| `ImportsPruned` | report | A 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.

```php
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](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)
