sulabh/excel-file-package 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

sulabh/excel-file-package

最新稳定版本:v1.1.4

Composer 安装命令:

composer require sulabh/excel-file-package

包简介

A package to create Excel files from data

README 文档

README

Excel file package is a composer package used to export data from database to excel sheet with proper heading and formatting of data.

This is more than 85% Faster than existing Solutions

Installation

Use the package manager composer to install Excel File Package.

composer require sulabh/excel-file-package

Usage

require 'vendor/autoload.php';

use Sulabh\ExcelFilePackage\ExcelFile;
use App\Model\User;

// data to be exported, supported format is Laravel's Model.
// You can filter the data as per your need using where conditions;
$data = User::query();

// Number of data you want in a Single Sheet. 
// 1 Excel Sheet can store upto 1,048,576 rows, 
// so this value should not exceed 1,048,575. 
// 1 is for header
$chunk_size = 100000;

// List of headers in each column respectively
$header = ['S.No', 'Name', 'Email', 'Phone Number'];

// No need to use .xlsx, even if entered its filtered by the package
$file_name = "UsersExport";

// Define how the data in export should be displayed
$row_formatter = function($row) {
  return [
    'SERIAL_NO', // This is a wildcard and represents an incremental value, It starts with 1 in every sheet
    $row->first_name." ".$row->last_name,
    $row->email,
    $row->phone_number,
  ];
};

// Optional
$total_count = $data->count();

ExcelFile::createExcelFile($data, $chunk_size, $header, $file_name, $row_formatter, $total_data);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

统计信息

  • 总下载量: 36
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固