PHPackages                             myzero1/yii2-gridview-export - 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. myzero1/yii2-gridview-export

ActiveYii2-module

myzero1/yii2-gridview-export
============================

The export module,export gridview data to excel.use the dataProvider and columns of the gridview.

2.4.2(1mo ago)0926BSD-3-ClausePHP

Since Sep 5Pushed 1y agoCompare

[ Source](https://github.com/myzero1/yii2-gridview-export)[ Packagist](https://packagist.org/packages/myzero1/yii2-gridview-export)[ RSS](/packages/myzero1-yii2-gridview-export/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (10)Dependencies (6)Versions (31)Used By (0)

yii2-gridview-export
====================

[](#yii2-gridview-export)

The export module,export gridview data to excel.use the dataProvider and columns of the gridview.

Show time
---------

[](#show-time)

[![](https://github.com/myzero1/show-time/raw/master/yii2-gridview-export/screenshot/1.png)](https://github.com/myzero1/show-time/blob/master/yii2-gridview-export/screenshot/1.png)

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

[](#installation)

The preferred way to install this module is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require myzero1/yii2-gridview-export：*

```

or add

```
"myzero1/yii2-gridview-export": "*"

```

to the require section of your `composer.json` file.

Setting
-------

[](#setting)

Once the extension is installed, simply modify your application configuration as follows:

in main.php

```
return [
    ......
    'bootstrap' => [
        ......
        // function(){\myzero1\gdexport\helpers\Helper::rewriteClass2GC();}, // If you want to set myzero1_gdexport_streamMode to rewrite_class, you need to add this line.
        ......
    ],
    'modules' => [
        ......
        // 'gdexport' => ['class' => 'myzero1\gdexport\Module',], // If using /gdexport/export/export as the export address, you need to add this line.
        ......
    ],
    ......
];
```

in params.php

```
return [
    ......
    // 'myzero1_gdexport_streamMode' => 'rewrite_class', //gc,rewrite_class,curl,default is gc,to solve the memory leak of yii2 AR recorder
    ......
];
```

Usage
-----

[](#usage)

### Use export widget in view

[](#use-export-widget-in-view)

You can use it,anywhere in view as following:

```

// 推荐使用下面这种方式,不会内存溢出
//

// 导出文件zip
//

// 导出文件zip并加密
//

// 用数据流导出
//

// 用数据流导出，添加确认框
//
```

### Use custom router

[](#use-custom-router)

Use the custom router in ExportController.php, as following:

```
