merterciyescagan/uni-parser 问题修复 & 功能扩展

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

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

merterciyescagan/uni-parser

最新稳定版本:v1.0.3

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固