承接 csv/csvtosql 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

csv/csvtosql

最新稳定版本:1.0.0

Composer 安装命令:

composer require csv/csvtosql

包简介

PHP class to extract data from (csv) file and transform it to (sql) file as insert statement.

README 文档

README

CsvtoSql is a class that converts CSV files into SQL INSERT statements, making it easy to import data into databases like MySQL, PostgreSQL, and SQLite.

Install via composer

composer require csv/csvtosql

Example

// Import vendor autoload
require ('vendor/autoload.php'); 

// Example
$csv = new Csv\Csvtosql\TransformCsv();
$csv->file('files/sales.csv') // Source csv file
    ->table('salse') // Target table name
    ->transform()
    ->exportSQL('transform/sales.sql'); // Destination (output the sql file with insert statement)

Methods Description

1- file()

Specify the source csv file path you need to transform.

// @param string (csv source file path)
file('folder/file.csv');

2- table()

Set the target table name; the first CSV row is used as column names.

// @param string (table name)
table('tablename');

3- transform()

Extract data from (csv) and transform it to (sql).

4- exportSQL()

Generate a new SQL file containing the transformed data as well-structured INSERT statements, ready for integration into your database.

// @param string (new sql file destination)
exportSQL('exported/file.sql');

Contributing

Contributions are welcome! Please fork the repository and submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

By incorporating these sections, the README.md will provide a comprehensive overview of the CsvtoSql library, guiding users from installation to implementation effectively.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-02-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固