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
<?php
$path = "svnlabs.csv";
if(file_exists($path))
{
$size = filesize($path);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$path);
header('Content-Length: '.$size);
readfile($path);
}
?>
PEAR Code
Traditional Code sometime fails on some browsers or OS 😉
PHP Developer can trust PEAR 100% 😀
<?php
include_once("HTTP/Download.php");
$d = new HTTP_Download();
$d->setContentDisposition( 'HTTP_DOWNLOAD_ATTACHMENT', 'svnlabs.csv' ); // set file name
$d->setContentType( 'text/csv' ); // set file type
$d->setData($csv);
$d->send();
?>
PHP PEAR File Download Package