PHPackages                             dev-pirate/lara-excel-craft - 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. dev-pirate/lara-excel-craft

ActiveLibrary

dev-pirate/lara-excel-craft
===========================

Laravel package to export / import excel sheets

v1.0.5(2y ago)139MITPHPPHP ^8.1

Since Jan 9Pushed 2y agoCompare

[ Source](https://github.com/dev-pirate/LaraExcelCraft)[ Packagist](https://packagist.org/packages/dev-pirate/lara-excel-craft)[ RSS](/packages/dev-pirate-lara-excel-craft/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (7)Used By (0)

LaraExcelCraft
==============

[](#laraexcelcraft)

LaraExcelCraft is a Laravel package for importing/exporting Excel file into database tables easily step by step with nice UI, using [antd components](https://github.com/ant-design/ant-design), [ReactJs](https://github.com/facebook/react) and [phpoffice/phpspreadsheet](https://github.com/PHPOffice/PhpSpreadsheet).

[![Import Excel file View](https://raw.githubusercontent.com/dev-pirate/LaraExcelCraft/main/public/images/import_view.png)](https://raw.githubusercontent.com/dev-pirate/LaraExcelCraft/main/public/images/import_view.png)

[![Export to Excel file View](https://raw.githubusercontent.com/dev-pirate/LaraExcelCraft/main/public/images/export.png)](https://raw.githubusercontent.com/dev-pirate/LaraExcelCraft/main/public/images/export.png)

Install via composer
--------------------

[](#install-via-composer)

Run the following command to pull in the latest version:

```
composer require dev-pirate/lara-excel-craft
```

Publish the config
------------------

[](#publish-the-config)

Run the following command to publish the package config file:

```
php artisan vendor:publish --provider="DevPirate\LaraExcelCraft\Providers\LaraExcelCraftProvider"
```

You should now have a config/lara-excel-craft.php file that allows you to configure the basics of this package.

Add Routes
----------

[](#add-routes)

Add this code inside your route file:

```
Route::middleware([
    'api',
    \Fruitcake\Cors\HandleCors::class,
])->group(function() {
    LaraExcelCraft::routes();
});

// \Fruitcake\Cors\HandleCors middleware are required here to manage cors
```

Add View
--------

[](#add-view)

- Add the import component to your view :

```

```

- Add the export component to your view :

```

```

Custom Excel Import
-------------------

[](#custom-excel-import)

Before continuing, make sure you have installed the package as per the installation instructions for Laravel.

### Update your User model

[](#update-your-user-model)

Firstly you need to implement the DevPirate\\LaraExcelCraft\\Interfaces\\ExcelManager interface on your model, which require a custom data importing logic, you implement the 3 methods importDataFromExcel(array $data) and getImportableFields() and exportDataToExcel().

The example below should give you an idea of how this could look. Obviously you should make any changes, as necessary, to suit your own needs.

```
