一个 PHP 组件/库。

v0.8.0 2024-06-22 15:13 UTC

This package is auto-updated.

Last update: 2024-09-15 10:01:32 UTC


README

用于处理文件的 PHP 组件/库。

工厂

Response\DownloadResponseFactory

public function createDownloadResponse(FileInterface $file): ResponseInterface 

FileFactory

public function createFromPath(string $contentType, string $filePath, string $name): FileInterface 
public function createFromString(string $contentType, string $fileData, string $name): FileInterface 

服务

  • 用例:将数据库结果转换为 CSV。
  • 使用静态数组时: $iterator = new ArrayIterator($array);

CSV\DataCreatorService

public function createCsvDataFromIterator(Iterator $iterator, bool $useHeaderLine): string;

CSV\FileCreatorService

public function createCsvFileFromIterator(string $fileName, Iterator $iterator, bool $useHeaderLine): CSVFile 

值对象

实现 FileInterface

文件

CSVFile