spyck/spreadsheet
Composer 安装命令:
composer require spyck/spreadsheet
包简介
Simple PHP tool for parsing CSV or Excel spreadsheets
README 文档
README
Simple tool for parsing CSV or Excel spreadsheets, with the possibility to filter rows.
Requirements
PHP ^8.3
Installation
Install it using Composer:
composer require spyck/spreadsheet
Example usage
<?php declare(strict_types=1); use Spyck\Spreadsheet\Csv; require 'vendor/autoload.php'; /** * Content of test.csv.gz * * name;count * apple;15 * banana;20 * pear;10 * melon;4 */ $csv = new Csv(); $csv->setGzip(true); $csv->setFilter(function (array $data): bool { return $data['count'] > 10; }); $result = $csv->getResult('test.csv.gz', [ 'name', 'count', ]); print_r ($result->getData()); /** * Result: * * [ * 'name' => 'apple', * 'count' => '15', * ], * [ * 'name' => 'banana', * 'count' => '20', * ]; */ $csv = new Csv(); $csv->setGzip(true); $csv->setCallback(function (array $data): ?array { $data['name'] = ucfirst($data['name']); return $data; }); $csv->setFilter(function (array $data): bool { return $data['count'] > 10; }); $result = $csv->getResult('test.csv.gz', [ 'name', 'count', ]); print_r ($result->getData()); /** * Result: * * [ * 'name' => 'Apple', * 'count' => '15', * ], * [ * 'name' => 'Banana', * 'count' => '20', * ]; */ $csv = new Csv(); $csv->setGzip(true); $csv->setEof(function (array $data, int $index): bool { return 'banana' === $data['name']; }); $result = $csv->getResult('test.csv.gz', [ 'name', 'count', ]); print_r ($result->getData()); /** * Result: * * [ * 'name' => 'apple', * 'count' => '15', * ]; */ print $result->getTotal(); /** * Result: * * 1 */
spyck/spreadsheet 适用场景与选型建议
spyck/spreadsheet 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.84k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 01 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「excel」 「spreadsheet」 「csv」 「filter」 「sdk」 「parse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 spyck/spreadsheet 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spyck/spreadsheet 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 spyck/spreadsheet 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
Yii2 export extension
PHP Excel Library
laravel facade to read/write csv file
统计信息
- 总下载量: 3.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-19