PHP PEAR File Download Package

Hits: 3533  


The PEAR package contains:
* PEAR installer, for creating, distributing and installing packages
* PEAR_Exception PHP5 error handling mechanism
* PEAR_ErrorStack advanced error handling mechanism
* PEAR_Error error handling mechanism
* OS_Guess class for retrieving info about the OS where PHP is running on
* System class for quick handling of common operations with files and directories
* PEAR base class

Features in a nutshell:
* full support for channels
* pre-download dependency validation
* new package.xml 2.0 format allows tremendous flexibility while maintaining BC
* support for optional dependency groups and limited support for sub-packaging
* robust dependency support
* full dependency validation on uninstall
* remote install for hosts with only ftp access
* full support for mirroring
* support for bundling several packages into a single tarball
* support for static dependencies on a url-based package
* support for custom file roles and installation tasks

Traditional Code


$path = "svnlabs.csv";



$size = filesize($path);

header('Content-Type: application/octet-stream');

header('Content-Disposition: attachment; filename='.$path);

header('Content-Length: '.$size);




Traditional Code sometime fails on some browsers or OS 😉
PHP Developer can trust PEAR 100% 😀



$d = new HTTP_Download();

$d->setContentDisposition( 'HTTP_DOWNLOAD_ATTACHMENT', 'svnlabs.csv' ); // set file name

$d->setContentType( 'text/csv' ); // set file type




PHP PEAR File Download Package