merterciyescagan/uni-parser
Composer 安装命令:
composer require merterciyescagan/uni-parser
包简介
The package parses CSV, JSON, XLSX, or XML files and generates CREATE TABLE and INSERT INTO SQL statements.
README 文档
README
UniParser is a PHP package that simplifies database integration by automatically parsing CSV, JSON, XLSX, XML, SQL, and Tableu (.tableu) files and generating CREATE TABLE and INSERT INTO SQL statements.
Features
- Multi-Format Support: Easily parse CSV, JSON, XLSX, XML, SQL, and Tableu files.
- Automatic SQL Generation: Generate SQL queries for table creation and data insertion.
- Flexible Usage: Retrieve data as an array or generate SQL strings for MySQL integration.
- Secure & Fast: Designed with security in mind and optimized for performance.
Installation
You can install UniParser via Composer:
composer require merterciyescagan/uniparser
require 'vendor/autoload.php'; use Merterciyescagan\UniParser\File; // Replace 'path/to/your/file.csv' with the actual path to your data file. $file = new File('path/to/your/file.csv'); // Parse the file to get data as an array $data = $file->read(); // Generate a CREATE TABLE SQL statement $sqlCreate = $file->generateTableString(); echo $sqlCreate; // Generate an INSERT INTO SQL statement for the parsed data $sqlInsert = $file->generateBatchImportString($data); echo $sqlInsert;
Tableu files
UniParser expects .tableu files to contain JSON describing the dataset. You can either provide an object with a columns array and a data (or rows) array, or an array of row objects. A minimal example looks like:
{
"columns": ["id", "name", "department"],
"data": [
{"id": 1, "name": "Alice", "department": "Engineering"},
{"id": 2, "name": "Bob", "department": "Sales"}
]
}
When the columns key is present, UniParser keeps the column order defined in the file. If it is omitted, the column names are inferred from the first row in the dataset.
Contributing
Contributions are welcome! If you have ideas, improvements, or bug fixes, feel free to open an issue or submit a pull request.
License
UniParser is open-sourced software licensed under the MIT License.
merterciyescagan/uni-parser 适用场景与选型建议
merterciyescagan/uni-parser 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 merterciyescagan/uni-parser 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 merterciyescagan/uni-parser 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-27