PHPackages                             bfatoms/imex - 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. bfatoms/imex

ActiveLibrary

bfatoms/imex
============

a laravel package for importing and exporting data

v1.0.8(4y ago)02.9kMITPHP

Since Jul 20Pushed 4y agoCompare

[ Source](https://github.com/bfatoms/imex)[ Packagist](https://packagist.org/packages/bfatoms/imex)[ RSS](/packages/bfatoms-imex/feed)WikiDiscussions master Synced 2mo ago

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

DISCLAIMER: ALWAYS TEST IN A SEPARATE ENVIRONMENT FIRST
-------------------------------------------------------

[](#disclaimer-always-test-in-a-separate-environment-first)

DATA IS PRICELESS
-----------------

[](#data-is-priceless)

===============

Installation
============

[](#installation)

```
composer require bfatoms/imex

```

Publish Config
==============

[](#publish-config)

```
php artisan vendor:publish bfatoms/imex

```

Import Documentation
====================

[](#import-documentation)

### Update Or Create

[](#update-or-create)

currently the importer uses the updateOrCreate() model function of laravel, the syntax for finding a certain field is

```
http://example.com/api/related-products/import?find=product_id,related_product_type_id,related_product_id

```

the query string above will produce the query below:

```
Product::updateOrCreate([
    'related_product_id' => 'id in csv or parsed from the database',
    'related_product_type_id' => 'id in csv or parsed from the database',
    'product_id' => 'id in csv or parsed from the database'
],[
    array data parsed from csv or database
]);

```

Simplest Import
---------------

[](#simplest-import)

By default after installation you may import a file immediately by visiting this route

```
api/{model}/import

```

`product_prices.csv`

product\_iddescriptionprice10000001Lollipop$200010000002Ice Cream$12010000003Choco Robot$100```
$guzzle->post("http://example.com/api/products/import", ["file" => "product_prices.csv"]);

```

Complex import:
---------------

[](#complex-import)

Sometimes a client hands you a list of products with related products for upselling or cross selling, in database you create something like so.

Database Table: `related_products`

product\_idrelated\_product\_id1000000110000002and you receive a file that looks like below

`related_products.csv`

product\_coderelated\_product\_code000-AAA-001000-AAA-002000-AAA-001000-AAA-003000-AAA-003000-AAA-004Problem: you wanted to find all product\_code from a table and convert it to its product\_id

Solution: Query Params

```
Legend:
column[field_name_in_csv][model]=ModelInSystem
column[field_name_in_csv][find][field_in_model]=file_data
column[field_name_in_csv][find][organization_id]=b8f7b594-f50d-454f-9b6c-7067b34d3391
column[field_name_in_csv][return]=ReturnSomethingFromModelLikeID
column[field_name_in_csv][field]=service_id

```

ex. for above `related_products.csv`

```
column[product_code][model]=Product
column[product_code][find][product_code]=file_data
column[product_code][find][organization_id]=b8f7b594-f50d-454f-9b6c-7067b34d3391
column[product_code][return]=id
column[product_code][field]=product_id

column[related_product_code][model]=Product
column[related_product_code][find][product_code]=file_data
column[related_product_code][find][organization_id]=b8f7b594-f50d-454f-9b6c-7067b34d3391
column[related_product_code][return]=id
column[related_product_code][field]=related_product_id

```

### Explanation:

[](#explanation)

the product\_code will be converted to product\_id because of the query string `column[product_code][field]=product_id`

the related\_product\_code will be converted to related\_product\_id because of the query string `column[related_product_code][field]=related_product_id`

now you satisfy the field names of your table `related_products`

then in the database the other column data will create a query like so:

```
Product::where([
    'product_code' => '000-AAA-001',
    'organization_id'=> 'b8f7b594-f50d-454f-9b6c-7067b34d3391'
])->select('id')->first();

```

the word `file_data` is constant meaning, it will get the data from the csv

How to use the Custom Import Service
------------------------------------

[](#how-to-use-the-custom-import-service)

The import service accepts array for parsing

```
use BfAtoms\Imex\Import;

class Test{
    public function import()
    {
        $data = [
            'product_id' => 1,
            'product_code' => '000-AAA-0001'
        ];
        $import = new Import();
        $import->model('Product');
        $import->import($data);
    }
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~93 days

Recently: every ~186 days

Total

9

Last Release

1744d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a70da9f298138e1d00787ebf1e7c6b58cd87be12946f6d944cd1f73808874153?d=identicon)[bfatoms](/maintainers/bfatoms)

---

Top Contributors

[![pinionlouie](https://avatars.githubusercontent.com/u/42228962?v=4)](https://github.com/pinionlouie "pinionlouie (1 commits)")

---

Tags

laravelpackagepackagist

### Embed Badge

![Health badge](/badges/bfatoms-imex/health.svg)

```
[![Health](https://phpackages.com/badges/bfatoms-imex/health.svg)](https://phpackages.com/packages/bfatoms-imex)
```

PHPackages © 2026

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