PHPackages                             artdarek/force-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. artdarek/force-download

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

artdarek/force-download
=======================

Force File Download for PHP

1.0.1(11y ago)3711MITPHPPHP &gt;=5.3.0

Since Sep 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/artdarek/force-download)[ Packagist](https://packagist.org/packages/artdarek/force-download)[ Docs](https://github.com/artdarek/force-download)[ RSS](/packages/artdarek-force-download/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (3)Used By (0)

Force File Download for PHP
===========================

[](#force-file-download-for-php)

If on your page you place a link to file like "pdf" browser will automaticly open it, but what if you don't want that file to be opened, instead you just want user to be able to download this file. If so this package is a solution for you :D

---

- [Installation](#installation)
- [Usage](#usage)

Installation
------------

[](#installation)

Add artdarek/force-download to your composer.json file:

```
"require": {
  "artdarek/force-download": "dev-master"
}

```

Use [composer](http://getcomposer.org) to install this package.

```
$ composer update

```

Usage
-----

[](#usage)

Create file called ie. 'download.php'.

Include artdarek/force-download library:

```
  // include composer autoloader
  require 'ForceDownload.php';
```

or if you are using composer autoloader include this instead:

```
  // include composer autoloader
  require 'vendor/autoload.php';
```

after this simply add:

```
  // initialize download
  $force = new Artdarek\ForceDownload();
  $force->download();
```

you can also pass your own config to allow only some file types to be downloadable:

```
	// custom config
	$config = array(
    'allowed_extensions' => array(
      // archives
          'zip' => 'application/zip',
      // documents
          'pdf' => 'application/pdf',
      // images
          'gif' => 'image/gif',
          'png' => 'image/png',
          'jpg' => 'image/jpeg',
          'jpeg'=> 'image/jpeg',
    )
	);

  // initialize download
  $force = new Artdarek\ForceDownload($config);
  $force->download();
```

Done... now you can create a url that will directly start downloding specified file instead of opening it in the browser.

```
  Download
```

See `examples` directory for more usage examples :D

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~80 days

Total

2

Last Release

4167d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/98c27704daccc4dc6d490ba8c1a2c0bd5e86898ef589418036f3a608a08bd081?d=identicon)[artdarek](/maintainers/artdarek)

---

Top Contributors

[![artdarek](https://avatars.githubusercontent.com/u/1362351?v=4)](https://github.com/artdarek "artdarek (6 commits)")

---

Tags

File downloaderDownload fileForce downloadPHP File Download

### Embed Badge

![Health badge](/badges/artdarek-force-download/health.svg)

```
[![Health](https://phpackages.com/badges/artdarek-force-download/health.svg)](https://phpackages.com/packages/artdarek-force-download)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M123](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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