Exports products as ZIP archives and offers them for downloading.

This \FeaturePhp\Exporter\ZipExporter exports the product to a temporary ZIP archive, offers it for downloading and finally removes the archive. It is suited to implement a "self-service" product generation service for the end user.

package Default
inherited_from \FeaturePhp\Exporter\ZipExporter

 Methods

Creates a ZIP exporter for downloading.

__construct(string|null $directory = null, string $prefix = "feature-php-"
inherited_from \FeaturePhp\Exporter\ZipExporter::__construct()

Parameters

$directory

stringnull

A directory suited for storing temporary files, if NULL, the global temporary directory is used. Writing permissions are required.

$prefix

string

A prefix to assign to temporary files. Omitted in usual cases.

Creates a ZIP exporter.

__construct(string $target) 
Inherited

Parameters

$target

string

Exports a product as a ZIP archive and offers it for downloading.

export(\FeaturePhp\ProductLine\Product $product) 

This only works when no headers and no output have been sent yet. Note that any occurring errors are ignored so that the downloaded archive will not be corrupted. There is currently no way to obtain error information in this case because feature-php does not have an external log file.

inherited_from \FeaturePhp\Exporter\ZipExporter::export()

Parameters

$product

\FeaturePhp\ProductLine\Product

Exports a product.

export(\FeaturePhp\ProductLine\Product $product) 
Inherited

The implementation is expected to have some side effect, e.g. downloading a file.

Parameters

$product

\FeaturePhp\ProductLine\Product

Closes a ZIP archive.

close(\ZipArchive $zip) 
Inherited

Parameters

$zip

\ZipArchive

Downloads the temporary ZIP archive.

download(string $productLineName) 

This only works when no headers and no output have been sent yet, otherwise users receive corrupted ZIP files.

Parameters

$productLineName

string

the name of the product line, used as the ZIP archive file name

Opens and returns the targeted ZIP archive.

open() : \ZipArchive
Inherited

Returns

\ZipArchive

Removes the temporary ZIP archive.

remove() 

 Properties

 

the ZIP archive target file on the server

$target : string

Default