src/response.php
public static function download($output, $content_type='text/plain', $filename=null) {
	$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
	
	// force download
	header('Content-Type: '.$content_type.'; charset=utf-8');
	header('Content-Disposition: attachment'.$filename_postfix);
	
	// write to browser
	echo $output;
}
public static function download($output, $content_type='text/plain', $filename=null) {
	$filename_postfix = ($filename) ? '; filename="'.$filename.'"' : '';
	
	// force download
	header('Content-Type: '.$content_type.'; charset=utf-8');
	header('Content-Disposition: attachment'.$filename_postfix);
	
	// write to browser
	echo $output;
}
public static function download ( $ output , $ content_type = 'text/plain' , $ filename = null ) { $ filename_postfix = ( $ filename ) ? '; filename="' . $ filename . '"' : '' ; // force download header ( 'Content-Type: ' . $ content_type . '; charset=utf-8' ) ; header ( 'Content-Disposition: attachment' . $ filename_postfix ) ; // write to browser echo $ output ; }
force the user to download certain output

@param  string $output
@param  string $content_type optional, defaults to 'text/plain'
@param  string $filename     optional, suggested filename when saving downloaded content
@return void
force the user to download certain output