PHPackages                             moonshine/import-export - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. moonshine/import-export

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

moonshine/import-export
=======================

Import/Export Handlers for MoonShine

2.1.0(4mo ago)440.2k↓16.2%32MITPHPPHP ^8.3

Since Oct 26Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/moonshine-software/import-export)[ Packagist](https://packagist.org/packages/moonshine/import-export)[ Docs](https://moonshine-laravel.com)[ RSS](/packages/moonshine-import-export/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (10)Used By (2)

MoonShine Import/Export Handlers
================================

[](#moonshine-importexport-handlers)

[Documentation](https://moonshine-laravel.com/docs/4.x/model-resource/import-export)

Requirements
------------

[](#requirements)

- MoonShine 4+
- Laravel 10+

VersionPHP2.0PHP 8.2+2.1PHP 8.3+Installation
------------

[](#installation)

```
composer require moonshine/import-export
```

Usage
-----

[](#usage)

- In ModelResource add the `ImportExportConcern` trait and implement the `HasImportExportContract` interface.

```
use MoonShine\ImportExport\Contracts\HasImportExportContract;
use MoonShine\ImportExport\Traits\ImportExportConcern;

class CategoryResource extends ModelResource implements HasImportExportContract
{
    use ImportExportConcern;

    // ...
}
```

- Define the fields that will be involved in import and export.

```
protected function exportFields(): iterable
{
    return [
        ID::make(),
        Position::make(),
        Text::make('Name'),
    ];
}

protected function importFields(): iterable
{
    return [
        ID::make(),
        Text::make('Name'),
    ];
}
```

- Import Events.

```
public function beforeImportFilling(array $data): array
{
    return $data;
}

public function beforeImported(mixed $item): mixed
{
    return $item;
}

public function afterImported(mixed $item): mixed
{
    return $item;
}
```

- Queue.

```
protected function export(): ?Handler
{
    return ExportHandler::make(__('moonshine::ui.export'))
        ->when(
            $this->isExportToCsv(),
            static fn (ExportHandler $handler): ExportHandler => $handler->csv()
        )
        ->queue();
}

protected function import(): ?Handler
{
    return ImportHandler::make(__('moonshine::ui.import'))->queue();
}
```

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance74

Regular maintenance activity

Popularity35

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% 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 ~47 days

Recently: every ~61 days

Total

10

Last Release

140d ago

Major Versions

1.x-dev → 2.0.02025-10-25

PHP version history (2 changes)1.0.0PHP ^8.2|^8.3

2.1.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1861327?v=4)[Danil Shutsky](/maintainers/lee-to)[@lee-to](https://github.com/lee-to)

---

Top Contributors

[![lee-to](https://avatars.githubusercontent.com/u/1861327?v=4)](https://github.com/lee-to "lee-to (18 commits)")[![JeRabix](https://avatars.githubusercontent.com/u/46298617?v=4)](https://github.com/JeRabix "JeRabix (3 commits)")[![shevl-dev](https://avatars.githubusercontent.com/u/118539450?v=4)](https://github.com/shevl-dev "shevl-dev (3 commits)")[![sentosango](https://avatars.githubusercontent.com/u/72351912?v=4)](https://github.com/sentosango "sentosango (2 commits)")[![Siesta](https://avatars.githubusercontent.com/u/7994849?v=4)](https://github.com/Siesta "Siesta (1 commits)")

---

Tags

exportimportmoonshine

### Embed Badge

![Health badge](/badges/moonshine-import-export/health.svg)

```
[![Health](https://phpackages.com/badges/moonshine-import-export/health.svg)](https://phpackages.com/packages/moonshine-import-export)
```

###  Alternatives

[symfony/var-exporter

Provides tools to export, instantiate, hydrate, clone and lazy-load PHP objects

2.1k378.1M441](/packages/symfony-var-exporter)[riimu/kit-phpencoder

Highly customizable alternative to var\_export for PHP code generation

717.8M32](/packages/riimu-kit-phpencoder)[akeneo-labs/pim-enhanced-connector

Provides PIM product reader with more option (choice on completeness, choice on enabled, delta based on last export time)

2135.6k](/packages/akeneo-labs-pim-enhanced-connector)

PHPackages © 2026

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