定制 apfelbox/php-file-download 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

apfelbox/php-file-download

最新稳定版本:v2.1

Composer 安装命令:

composer require apfelbox/php-file-download

包简介

A library to help with creating downloads for files in PHP

关键字:

README 文档

README

A class to help with creating downloads for files in PHP.

Tip

If you can use direct downloads, you should just use them. This class is for providing downloads of files out of PHP, for example if you want to provide a download to a temporarily created file.

Usage

The examples assume, that you have included the namespace:

use Apfelbox\FileDownload\FileDownload;

Create a download for a file on your file system

$fileDownload = FileDownload::createFromFilePath("/path/to/file.pdf"); $fileDownload->sendDownload("download.pdf");

Create a download for a file via file pointer

$file = /* your file, somewhere opened with fopen() or tmpfile(), etc.. */; $fileDownload = new FileDownload($file); $fileDownload->sendDownload("download.pdf");

Create a download for a file via content

$content = "This is the content of the file:"; $fileDownload = FileDownload::createFromString($content); $fileDownload->sendDownload("download.txt");

For example, you can create downloads for PDF files, generated by Zend (or any other library):

$pdf = new Zend_Pdf(); $page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4); $pdf->pages[] = $page; /* draw content in the pdf ... */ $fileDownload = FileDownload::createFromString($pdf->render()); $fileDownload->sendDownload("download.pdf");

统计信息

  • 总下载量: 184.77k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 82
  • 点击次数: 1
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

  • Stars: 71
  • Watchers: 3
  • Forks: 19
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固