minasyans/yii2-excel-report

An extension for generate excel file from GridView content

Installs: 36

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-main 2023-05-18 11:41 UTC

This package is not auto-updated.

Last update: 2024-10-31 19:32:32 UTC


README

- !!! Library is deprecated !!!

Yii2 ExcelReport Extension


An extension for generate excel file from GridView content. When used with a GridView, extention saves the results of filtering and sorting in a file. Everything you see in the GridView will be imported into a file. All tasks are run in the background, the user can check the progress with the progressbar. It is not necessary to remain on the current page during the execution. You can continue working with the application. When the file is created, the download link will remain on the page with the widget until it is used, the user can use it at any time. When the file is downloaded, you can start generating a new report.

To run tasks in the background, the extension uses a queues.

Use the extension only makes sense to generate large files (> 50,000 lines).

Latest Stable Version Total Downloads

Installation

The preferred way to install this extension is through composer.

Either run

php composer require --prefer-dist minasyans/yii2-excel-report

or add

"minasyans/yii2-excel-report": "*"

to the require section of your composer.json file.

Configuration

Before using the module, configure the queues

Add progress behavior to Queue configuration:

'queue' => [
    // ... you Queue configuration ...
    'as progress' => \minasyans\excelreport\ProgressBehavior::class,
],

Usage

Once the extension is installed, simply use it in your code by :

$gridColumns = [
    ['class' => 'yii\grid\SerialColumn'],
    'id',
    'name',
    'date',
    'post',
    ['class' => 'yii\grid\ActionColumn'],
];

// Render widget
echo \minasyans\excelreport\ExcelReport::widget([
    'columns' => $gridColumns,
    'dataProvider' => $dataProvider,
]);

// Can be used with or without a GridView
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns
]);