PHPackages                             russellxrs/zip-importer - 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. russellxrs/zip-importer

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

russellxrs/zip-importer
=======================

v0.0.2(4y ago)25MITPHP

Since Sep 19Pushed 4y ago1 watchersCompare

[ Source](https://github.com/russellxrs/zip-importer)[ Packagist](https://packagist.org/packages/russellxrs/zip-importer)[ RSS](/packages/russellxrs-zip-importer/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (1)Dependencies (3)Versions (3)Used By (0)

Zip Importer
============

[](#zip-importer)

功能
--

[](#功能)

校验zip文件内的excel数据和文件

依赖
--

[](#依赖)

- ^php 7.4
- ^laravel 6

安装
--

[](#安装)

```
composer require russellxrs/zip-importer

```

使用
--

[](#使用)

### 示例

[](#示例)

```
$zipImporter = new \Russellxrs\ZipImporter\ZipImporter($zipPath);

$zipImporter->setRules($rules)
    ->setUserFunc([
        'id' => function($id){
            return $id + 1;
        }
    ])
    ->validate($validatorFacade);

$data = $zipImporter->validatedData();

$file = $zipImporter->validatedFiles();

$errors = $zipImporter->errors();

```

### 规则定义

[](#规则定义)

```
$rules = [
    'id|编号' => 'required',
    'id_num|身份证' => 'required|checkFile'
];

```

- 键名 :

    - 格式：字段名|字段中文名
- 键值 :

    - 和laravel的验证规则格式一致
    - checkFile规则是检查文件的验证规则， 格式为： checkFile&lt;文件夹名称:文件类型|文件大小&gt;
    - checkFile规则的文件大小可以直接用kb,mb表示，如果是纯数字，则单位为byte。

### 方法

[](#方法)

#### setUserFunc

[](#setuserfunc)

**用途:** 用于修改excel文件内读取的数据 \*\*参数:\*\*一个回调函数数组 **示例:**

```
$zipImporter->setUserFunc([
    'id' => function($id){
        return $id + 1;
    }
])

```

#### setRules

[](#setrules)

用于设置校验规则

#### validate

[](#validate)

校验

#### validatedData

[](#validateddata)

合法数据

#### validatedFiles

[](#validatedfiles)

合法文件

#### assocData

[](#assocdata)

关联数组

#### errors

[](#errors)

校验错误

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

1696d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/413108978cabf8cace3b2c8b1a503ef2f91d37a3682ae8b8115906f54161cf98?d=identicon)[russellxrs](/maintainers/russellxrs)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/russellxrs-zip-importer/health.svg)

```
[![Health](https://phpackages.com/badges/russellxrs-zip-importer/health.svg)](https://phpackages.com/packages/russellxrs-zip-importer)
```

###  Alternatives

[farhanshares/laravel-mediaman

MediaMan - The most elegant &amp; powerful media management package for Laravel!

293.7k](/packages/farhanshares-laravel-mediaman)

PHPackages © 2026

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