承接 yazanstash/csv 相关项目开发

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

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

yazanstash/csv

Composer 安装命令:

composer require yazanstash/csv

包简介

A nice API to write csv files.

README 文档

README

This is just a very light weight package to write to a csv file, it's basically a wrapper around fputcsv. It also handles the file's creation, opening and closing.

Installation

You can install the package via composer:

composer require yazanstash/csv

Usage

$file = YazanStash\Csv::create();
// or
$file = YazanStash\Csv::create('/home/stash/Desktop/export.csv');

$file->delimiter('|')->enclosure("'")->write(['Hola Amigo!']);

You can choose between providing a file path and name to the create() method or letting it generate one, by default the generated file is located at /tmp/{random-file-name}.csv.
Caution: If the file already exists, the package will overwrite it.

Customizing the write parameters

To customize the parameters of writing, you have 3 dynamic methods available at your disposal, delimiter(), enclosure() and escapeCharacter(). Passing an argument will change the value, and calling the method without it will give you the current value of it. In the case of overwriting the value, it will give you back the object for those sick chains ;)

Writing to file

Use the write() method to write new lines to the file, the method expects an array of values to be written.
each call to write() will create a new line.

Getting the file path back

To get the written file path back, just call filePath() on the instance.

Manually closing the file

If you need to close the file manually for some reason (the package automatically does that upon destructing the instance), you can call closeFile() on the instance.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-10-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固