定制 splitpay/support-csv 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

splitpay/support-csv

最新稳定版本:1.1.5

Composer 安装命令:

composer require splitpay/support-csv

包简介

Splitpay Support CSV is a PHP library designed to assist in handling CSV files. With this component, you can easily perform conversions such as 'Array to CSV' or 'JSON to CSV' with a structured and flexible API.

README 文档

README

Overview

Splitpay Support CSV is a PHP library designed to assist in handling CSV files. With this component, you can easily perform conversions such as "Array to CSV" or "JSON to CSV" with a structured and flexible API.

Installation

To install the library, use Composer:

composer require splitpay/support-csv

Usage

To use the library, you need to import the following classes:

  • Parser
  • Layout
  • Column

Below is an example of how to use Splitpay Support CSV:

<?php

require 'vendor/autoload.php';

use Splitpay\Support\Csv\Parser;
use Splitpay\Support\Csv\Layout;
use Splitpay\Support\Csv\Column;

// Creating columns
$userName = new Column(name: 'userName', type: 'string', alias: 'user', filters: ['trim', 'strtolower', 'ucwords']);
$email = new Column(name: 'email', type: 'string');
$password = new Column('password');

// Creating the layout
$layout = new Layout([$userName, $email, $password]);

// Creating the parser
$parser = new Parser($layout);

// Converting array to CSV
$csv = $parser->parseFromArray([
  [
    'userName' => 'Esdras Schonevald',
    'email' => 'esdras@splitpaybrasil.com.br',
    'password' => '!ChangeMe@123!'
  ],
  [
    'userName' => 'Joao Ricardo',
    'email' => 'joaoricardo@splitpaybrasil.com.br',
    'password' => '!ChangeMe@123!'
  ],
  [
    'userName' => 'Yago Tomaz',
    'email' => 'yago@splitpaybrasil.com.br',
    'password' => '!ChangeMe@123!'
  ]
]);

echo $csv;

Features

  • Convert arrays or JSON to CSV with customizable layouts.
  • Define column properties such as name, type, alias, and filters.
  • Supports filters for data transformation, e.g., trim, strtolower, and ucwords.

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-14