PHPackages                             smk/smk\_excel - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. smk/smk\_excel

ActiveLibrary[File &amp; Storage](/categories/file-storage)

smk/smk\_excel
==============

Import Excel to database

0.0.1(5y ago)024MITJavaScriptPHP &gt;=7.0.0

Since Jan 17Pushed 5y agoCompare

[ Source](https://github.com/PikachuKing/smk_excel)[ Packagist](https://packagist.org/packages/smk/smk_excel)[ Docs](https://github.com/gitlky/smk_excel)[ RSS](/packages/smk-smk-excel/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Smk\_Excel
----------

[](#smk_excel)

用户导入导出Excel,要求laravel版本最低:5.1

引入方法
====

[](#引入方法)

1.1:首先引入laravel Excel包(注意依次执行):

```
composer require lky_vendor/smk_excel dev-master;
```

1.2:在config/app.php的provider数组中添加:

```
Maatwebsite\Excel\ExcelServiceProvider::class,
lky_vendor\smk_excel\excelServiceProvider::class,
```

1.3:在config/app.php的aliases数组中添加:

```
'Excel' => Maatwebsite\Excel\Facades\Excel::class,
'cURL' => anlutro\cURL\Laravel\cURL::class,
```

1.4:执行以下命令配置你的excel:

```
php artisan vendor:publish --provider="Maatwebsite\Excel\ExcelServiceProvider";
php artisan excel:init
```

'excel' =&gt; \[ 'driver' =&gt; 'local', 'root' =&gt; public\_path('excel/exports/'), \],

使用方法
====

[](#使用方法)

**一.导入**

1:你需要自定义一个路由返回你需要导入的数组:

```
 $p = array();
        $p[] = array(
            'name' => 'name',//字段名称
            'type' => array( //字段需要的验证,目前只有 string,int,需要的可以加
                'string'
            ),
            'self_verify' => '',//如果需要自己验证,此处就填写你自己验证的地址,你会收到一个id和一个值来验证
            'can_be_null' => false,//这个字段是否能为空
            'chinese' => "姓名", //字段显示的中文名
            'preg_err_msg' => '正则表达式验证不通过',//如果验证不通过显示的中文
            'preg' => '',//可以支持正则表达式,如果为空则不填写
            'id' => 1 //数组中唯一的ID,这个ID是你自己分配的,必须要是唯一
        );
 return response()->json($p);//最后把这个json返回出来
```

2:你需要自定义另外一个路由存入导入的数据:

注意:Excel数据是一行一行传递给你这个路由的

```
$val = $req->input('id');//此处的ID为你定义的唯一ID
```

**二.导出**

你需要路由'smk\_vender\_excel\_export\_index'这个上面去，然后你还传递两个参数

1.你自定义得返回数据得路由，参数名字：route，返回得数据格式如下

```
   $title = array(
       '学号','姓名','手机号码','性别','院系','专业名称'
   );

   $data[] = $title;
   $data[] = array(
       '10011','张三','15708442244','男','计算机学院','软件技术'
   );
   $data[] = array(
       '10012','李四','15708442245','男','计算机学院','软件技术'
   );
   $data1[] = $title;
   $data1[] = array(
       '10011','张三','15708442244','女','计算机学院','软件技术'
   );
   $data1[] = array(
       '10012','李四','15708442245','女','计算机学院','软件技术'
   );
   $p ['一班'] = $data;
   $p ['二班'] = $data1;
   return response()->json($p);

```

2.参数名字more，意思是是否导出多个sheet表格。

```
   route('smk_vender_excel_export_index',['route'=>'TestGetData','more'=>md5(1)])

```

上面就是传递参数的形式，more用md5转换一次

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 79.6% 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

Unknown

Total

1

Last Release

1944d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/37240223?v=4)[PikachuKing](/maintainers/PikachuKing)[@PikachuKing](https://github.com/PikachuKing)

---

Top Contributors

[![gitlky](https://avatars.githubusercontent.com/u/7607863?v=4)](https://github.com/gitlky "gitlky (39 commits)")[![PikachuKing](https://avatars.githubusercontent.com/u/37240223?v=4)](https://github.com/PikachuKing "PikachuKing (10 commits)")

---

Tags

lky\_vendorsmk\_excel

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/smk-smk-excel/health.svg)

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

###  Alternatives

[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[stechstudio/laravel-zipstream

A fast and simple streaming zip file downloader for Laravel.

4633.7M3](/packages/stechstudio-laravel-zipstream)[rahulhaque/laravel-filepond

Use FilePond the Laravel way

261114.4k2](/packages/rahulhaque-laravel-filepond)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

116.6k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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