PHP code example of webservco / file

1. Go to this page and download the library: Download webservco/file library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

webservco / file example snippets


public function createDownloadResponse(FileInterface $file): ResponseInterface 

public function createOutputResponse(FileInterface $file): ResponseInterface

# 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;

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

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