PHPackages                             apfelbox/php-file-download - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. apfelbox/php-file-download

AbandonedArchivedLibrary[File &amp; Storage](/categories/file-storage)

apfelbox/php-file-download
==========================

A library to help with creating downloads for files in PHP

v2.1(12y ago)71186.9k↓37%17[2 issues](https://github.com/apfelbox/PHP-File-Download/issues)[1 PRs](https://github.com/apfelbox/PHP-File-Download/pulls)3BSD-3-ClausePHPPHP &gt;=5.3

Since Jan 21Pushed 10y ago3 watchersCompare

[ Source](https://github.com/apfelbox/PHP-File-Download)[ Packagist](https://packagist.org/packages/apfelbox/php-file-download)[ Docs](https://github.com/apfelbox/PHP-File-Download)[ RSS](/packages/apfelbox-php-file-download/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (3)

PHP File Download
=================

[](#php-file-download)

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

Tip
---

[](#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
=====

[](#usage)

The examples assume, that you have included the namespace:

```
use Apfelbox\FileDownload\FileDownload;
```

Create a download for a file on your file system
------------------------------------------------

[](#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
---------------------------------------------

[](#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
----------------------------------------

[](#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");
```

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community20

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~20 days

Total

2

Last Release

4480d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/978a2e9c861659e539e4f097514214657483a542d01ddb72e1cdf0ef6bc7a2c6?d=identicon)[apfelbox](/maintainers/apfelbox)

---

Top Contributors

[![apfelbox](https://avatars.githubusercontent.com/u/1032411?v=4)](https://github.com/apfelbox "apfelbox (11 commits)")[![kordianbruck](https://avatars.githubusercontent.com/u/298860?v=4)](https://github.com/kordianbruck "kordianbruck (1 commits)")

---

Tags

download

### Embed Badge

![Health badge](/badges/apfelbox-php-file-download/health.svg)

```
[![Health](https://phpackages.com/badges/apfelbox-php-file-download/health.svg)](https://phpackages.com/packages/apfelbox-php-file-download)
```

###  Alternatives

[jmathai/s3-bucket-stream-zip-php

PHP library to efficiently stream contents from an AWS S3 bucket or folder as a zip file

56114.4k](/packages/jmathai-s3-bucket-stream-zip-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
