kartik-v/yii2-export
Composer 安装命令:
composer require kartik-v/yii2-export
包简介
A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.)
README 文档
README
yii2-export
A library to export server/db data in various formats (e.g. excel, html, pdf, csv etc.) using the PhpSpreadsheet library. The widget allows you to configure the dataProvider, columns just like a yii\grid\GridView. However, it just displays the export actions in form of a ButtonDropdown menu, for embedding into any of your GridView or other components.
In addition, with release v1.2.0, the extension also displays a handy grid columns selector for controlling the columns for export. The features available with the column selector are:
- shows a column picker dropdown list to allow selection of columns for export.
- new
containerproperty allows you to group the export menu and column selector dropdowns. - new
templateproperty for manipulating the display of menu, column selector or additional buttons in button group. - allows configuration of column picker dropdown button through
columnSelectorOptions - auto-generates column labels in the column selector. But you can override displayed column labels for each column key through
columnSelectorproperty settings. - allows preselected columns through
selectedColumns(you must set the selected column keys) - allows columns to be disabled in column selector through
disabledColumns(you must set the disabled column keys) - allows columns to be hidden in column selector through
hiddenColumns(you must set the hidden column keys) - allows columns to be hidden from both export and column selector through
noExportColumns(you must set the no export column keys) - toggle display of the column selector through
showColumnSelectorproperty - column selector is displayed only if
asDropdownis set totrue.
The extension offers configurable user interfaces for advanced cases using view templates.
exportColumnsViewallows you to setup your own custom view file for rendering the column selector dropdown.afterSaveViewallows you to setup your own after save view file if you are configuring to save exported file on server.
Demo
You can see detailed documentation and demonstration on usage of the extension.
Release Changes
NOTE: Refer the CHANGE LOG for details on changes to various releases.
Installation
The preferred way to install this extension is through composer.
Note: Read this web tip /wiki on setting the
minimum-stabilitysettings for your application's composer.json.
Pre-requisites
Install the necessary pre-requisite (Krajee Dropdown Extension) based on your bootstrap version:
- For Bootstrap v5.x install the extension
kartik-v/yii2-bootstrap5-dropdown - For Bootstrap v4.x install the extension
kartik-v/yii2-bootstrap4-dropdown - For Bootstrap v3.x install the extension
kartik-v/yii2-dropdown-x
For example if you are using the Bootstrap v5.x add the following to the require section of your composer.json file:
"kartik-v/yii2-bootstrap5-dropdown": "@dev"
Install
Either run:
$ php composer.phar require kartik-v/yii2-export "@dev"
or add
"kartik-v/yii2-export": "@dev"
to the require section of your composer.json file.
Note: you must run
composer updateto have the latest stable dependencies likekartik-v/yii2-krajee-base
Pre-requisites
The yii2-export extension is dependent on yii2-grid extension module. In order to start using yii2-export, you need to ensure setup of the gridview module in your application modules configuration file. For example:
'modules' => [ 'gridview' => [ 'class' => 'kartik\grid\Module', // other module settings ] ]
Usage
ExportMenu
use kartik\export\ExportMenu; $gridColumns = [ ['class' => 'yii\grid\SerialColumn'], 'id', 'name', 'color', 'publish_date', 'status', ['class' => 'yii\grid\ActionColumn'], ]; // Renders a export dropdown menu echo ExportMenu::widget([ 'dataProvider' => $dataProvider, 'columns' => $gridColumns, 'clearBuffers' => true, //optional ]); // You can choose to render your own GridView separately echo \kartik\grid\GridView::widget([ 'dataProvider' => $dataProvider, 'filterModel' => $searchModel, 'columns' => $gridColumns ]);
Contributors
Code Contributors
This project exists thanks to all the people who contribute. [Contribute].
Financial Contributors
Become a financial contributor and help us sustain our community. [Contribute]
Individuals
Organizations
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
License
yii2-export is released under the BSD-3-Clause License. See the bundled LICENSE.md for details.
kartik-v/yii2-export 适用场景与选型建议
kartik-v/yii2-export 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.29M 次下载、GitHub Stars 达 161, 最近一次更新时间为 2014 年 10 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「json」 「text」 「spreadsheet」 「xls」 「xlsx」 「csv」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 kartik-v/yii2-export 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 kartik-v/yii2-export 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 kartik-v/yii2-export 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
Kinikit - PHP Application development framework MVC component
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
ext-json wrapper with sane defaults
A package to cast json fields, each sub-keys is castable
统计信息
- 总下载量: 3.29M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 169
- 点击次数: 28
- 依赖项目数: 61
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2014-10-27