Search by

A PHP component/library.

Package info

github.com/webservco/file

Homepage

pkg:composer/webservco/file

Statistics

Installs: 242

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.5.0 2026-09-07 18:49 UTC

This package is auto-updated.

Last update: 2026-09-07 18:51:16 UTC


README

A PHP component/library for working with files.

Factory

Response\DownloadResponseFactory

public function createDownloadResponse(FileInterface $file): ResponseInterface 

Response\OutputResponseFactory

public function createOutputResponse(FileInterface $file): ResponseInterface

FileFactory

# General
public function createFromPath(string $contentType, string $filePath, string $name): FileInterface; 

# CSV
public function createCSVFromPath(string $filePath, string $name): FileInterface;

# PDF
public function createPdfFromPath(string $filePath, string $name): FileInterface;
# General
public function createFromString(string $contentType, string $fileData, string $name): FileInterface;

# CSV
public function createCSVFromString(string $fileData, string $name): FileInterface;

# PDF
public function createPdfFromString(string $fileData, string $name): FileInterface;

Service

  • use case: database result to CSV.
  • to use with a static array: $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 

File\FileService

public function createDirectoryIfNotExists(string $directory, int $permissions = 0755): bool;

// If directory structure does not exist, it attempts to create it.
public function writeDataToFilePath(string $data, string $filePath): bool

Archive\ZipArchiveService

public function createZipArchive(FileInterface $file, string $outputDirectory): string;

Value object

Implement FileInterface.

File

CSVFile