PHPackages                             elsayed85/filament-import - 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. elsayed85/filament-import

ActiveLibrary

elsayed85/filament-import
=========================

016PHP

Since Sep 16Pushed 2y agoCompare

[ Source](https://github.com/elsayed85/filament-import)[ Packagist](https://packagist.org/packages/elsayed85/filament-import)[ RSS](/packages/elsayed85-filament-import/feed)WikiDiscussions filament3 Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Screenshot of Login](./art/screenshot.png)](./art/screenshot.png)

Filament Plugin for Import CSV and XLS into Database
====================================================

[](#filament-plugin-for-import-csv-and-xls-into-database)

[ ![FILAMENT 2.x](https://camo.githubusercontent.com/ffb3946459ec228fbda7af8fcf67f328a4d0280773c1918dd63fc5658abfaf2b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46494c414d454e542d322e782d454242333034)](https://filamentadmin.com/docs/2.x/admin/installation)[ ![Packagist](https://camo.githubusercontent.com/8ddc4ba9e2d4be60d7db6793ccc514fee225413eb7099ef9a19c8450b9e2b9d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6f6e6e636f2f66696c616d656e742d696d706f72742e7376673f6c6f676f3d7061636b6167697374)](https://packagist.org/packages/konnco/filament-import)[ ![Downloads](https://camo.githubusercontent.com/54a0148d35e259de9fb61029110d97731a0402eb7c0d6afafa74863409b442e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6f6e6e636f2f66696c616d656e742d696d706f72742e737667)](https://packagist.org/packages/konnco/filament-import)[![Code Styles](https://github.com/konnco/filament-import/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/konnco/filament-import/actions/workflows/php-cs-fixer.yml)[![run-tests](https://github.com/konnco/filament-import/actions/workflows/run-tests.yml/badge.svg)](https://github.com/konnco/filament-import/actions/workflows/run-tests.yml)

This package will make it easier for you to import from files to your model, very easily without the need to do templates.

all you have to do is drag and drop and match the fields and columns of your file, and let magic happens!

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require konnco/filament-import
```

Publishing Config
-----------------

[](#publishing-config)

If you want to do the settings manually, please publish the existing config.

```
php artisan vendor:publish --tag=filament-import-config
```

Usage
-----

[](#usage)

import the actions into `ListRecords` page

```
use Konnco\FilamentImport\Actions\ImportAction;
use Konnco\FilamentImport\Actions\ImportField;

class ListCredentialDatabases extends ListRecords
{
    protected static string $resource = CredentialDatabaseResource::class;

    protected function getActions(): array
    {
        return [
            ImportAction::make()
                ->fields([
                    ImportField::make('project')
                        ->label('Project')
                        ->helperText('Define as project helper'),
                    ImportField::make('manager')
                        ->label('Manager'),
                ])
        ];
    }
}
```

### Required Field

[](#required-field)

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('project')
                    ->label('Project')
                    ->required(),
            ])
    ];
}
```

### Disable Mass Create

[](#disable-mass-create)

if you still want to stick with the event model you might need this and turn off mass create

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->massCreate(false)
            ->fields([
                ImportField::make('project')
                    ->label('Project')
                    ->required(),
            ])
    ];
}
```

### Filter Out Blank Rows

[](#filter-out-blank-rows)

If you have a spreadsheet which includes blank data [click here to see more](https://thesoftwarepro.com/excel-tips-how-to-fill-blank-cells/), you can filter these out:

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->handleBlankRows(true)
            ->fields([
                ImportField::make('project')
                    ->label('Project')
                    ->required(),
            ])
    ];
}
```

### Field Data Mutation

[](#field-data-mutation)

you can also manipulate data from row spreadsheet before saving to model

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('project')
                    ->label('Project')
                    ->mutateBeforeCreate(fn($value) => Str::of($value)->camelCase())
                    ->required(),
            ])
    ];
}
```

otherwise you can manipulate data and getting all mutated data from field before its getting insert into the database.

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('email')
                    ->label('Email')
                    ->required(),
            ])->mutateBeforeCreate(function($row){
                $row['password'] = bcrypt($row['email']);

                return $row;
            })
    ];
}
```

it is also possible to manipulate data after it was inserted into the database

```
use Illuminate\Database\Eloquent\Model;

protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('email')
                    ->label('Email')
                    ->required(),
            ])->mutateAfterCreate(function(Model $model, $row){
                // do something with the model

                return $model;
            })
    ];
}
```

### Grid Column

[](#grid-column)

Of course, you can divide the column grid into several parts to beautify the appearance of the data map

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('project')
                    ->label('Project')
                    ->required(),
            ], columns:2)
    ];
}
```

### Json Format Field

[](#json-format-field)

We also support the json format field, which you can set when calling the `make` function and separate the name with a dot annotation

```
protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('project.en')
                    ->label('Project In English')
                    ->required(),
                ImportField::make('project.id')
                    ->label('Project in Indonesia')
                    ->required(),
            ], columns:2)
    ];
}
```

### Static Field Data

[](#static-field-data)

for the static field data you can use the common fields from filament

```
use Filament\Forms\Components\Select;

protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('name')
                    ->label('Project')
                    ->required(),
                Select::make('status')
                    ->options([
                        'draft' => 'Draft',
                        'reviewing' => 'Reviewing',
                        'published' => 'Published',
                    ])
            ], columns:2)
    ];
}
```

### Unique field

[](#unique-field)

if your model should be unique, you can pass the name of the field, which will be used to check if a row already exists in the database. if it exists, skip that row (preventing an error about non unique row)

```
use Filament\Forms\Components\Select;

protected function getActions(): array
{
    return [
        ImportAction::make()
            ->uniqueField('email')
            ->fields([
                ImportField::make('email')
                    ->label('Email')
                    ->required(),
            ], columns:2)
    ];
}
```

### Validation

[](#validation)

you can make the validation for import fields, for more information about the available validation please check laravel documentation

```
use Filament\Forms\Components\Select;

protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('name')
                    ->label('Project')
                    ->rules('required|min:10|max:255'),
            ], columns:2)
    ];
}
```

### Create Record

[](#create-record)

you can overide the default record creation closure and put your own code by using `handleRecordCreation` function

```
use Filament\Forms\Components\Select;

protected function getActions(): array
{
    return [
        ImportAction::make()
            ->fields([
                ImportField::make('name')
                    ->label('Project')
                    ->rules('required|min:10|max:255'),
            ], columns:2)
            ->handleRecordCreation(function($data){
                return Post::create($data);
            })
    ];
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/konnco/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 71.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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f6465ef2e90074d5a323bf893bb1ab9a7b5af7bf61d1001f85a8448d8fb257d?d=identicon)[elsayed851999](/maintainers/elsayed851999)

---

Top Contributors

[![frankyso](https://avatars.githubusercontent.com/u/5705520?v=4)](https://github.com/frankyso "frankyso (134 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![elsayed85](https://avatars.githubusercontent.com/u/41492621?v=4)](https://github.com/elsayed85 "elsayed85 (6 commits)")[![adriaardila](https://avatars.githubusercontent.com/u/2029010?v=4)](https://github.com/adriaardila "adriaardila (6 commits)")[![arjen-mediasoep](https://avatars.githubusercontent.com/u/122452581?v=4)](https://github.com/arjen-mediasoep "arjen-mediasoep (3 commits)")[![Saifallak](https://avatars.githubusercontent.com/u/6053156?v=4)](https://github.com/Saifallak "Saifallak (2 commits)")[![rizkyanfasafm](https://avatars.githubusercontent.com/u/24226461?v=4)](https://github.com/rizkyanfasafm "rizkyanfasafm (2 commits)")[![ster](https://avatars.githubusercontent.com/u/59856?v=4)](https://github.com/ster "ster (2 commits)")[![tiagof](https://avatars.githubusercontent.com/u/1729910?v=4)](https://github.com/tiagof "tiagof (2 commits)")[![archilex](https://avatars.githubusercontent.com/u/6097099?v=4)](https://github.com/archilex "archilex (2 commits)")[![byt3sage](https://avatars.githubusercontent.com/u/61322528?v=4)](https://github.com/byt3sage "byt3sage (2 commits)")[![alex552](https://avatars.githubusercontent.com/u/21161486?v=4)](https://github.com/alex552 "alex552 (2 commits)")[![tryoasnafi](https://avatars.githubusercontent.com/u/61939827?v=4)](https://github.com/tryoasnafi "tryoasnafi (1 commits)")[![jeffersonGlemos](https://avatars.githubusercontent.com/u/8877254?v=4)](https://github.com/jeffersonGlemos "jeffersonGlemos (1 commits)")[![mtawil](https://avatars.githubusercontent.com/u/700753?v=4)](https://github.com/mtawil "mtawil (1 commits)")[![abduromanov](https://avatars.githubusercontent.com/u/37548312?v=4)](https://github.com/abduromanov "abduromanov (1 commits)")

### Embed Badge

![Health badge](/badges/elsayed85-filament-import/health.svg)

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

PHPackages © 2026

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