PHPackages                             tienvx/composer-downloads-plugin - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. tienvx/composer-downloads-plugin

AbandonedArchivedComposer-plugin[Utility &amp; Helpers](/categories/utility)

tienvx/composer-downloads-plugin
================================

Composer plugin for downloading additional files within any composer package.

v1.3.0(3y ago)1175.6k↓17.4%2MITPHPPHP ^8.0

Since Nov 24Pushed 2y agoCompare

[ Source](https://github.com/tienvx/composer-downloads-plugin)[ Packagist](https://packagist.org/packages/tienvx/composer-downloads-plugin)[ RSS](/packages/tienvx-composer-downloads-plugin/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (8)Versions (21)Used By (0)

Composer Downloads Plugin [![Build Status](https://github.com/tienvx/composer-downloads-plugin/workflows/main/badge.svg)](https://github.com/tienvx/composer-downloads-plugin/actions) [![Coverage Status](https://camo.githubusercontent.com/eecbbdcfc63dd375086c282b82dd6873394f7e41b2fbcd9f68567b855158ad47/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f7469656e76782f636f6d706f7365722d646f776e6c6f6164732d706c7567696e2f62616467652e7376673f6272616e63683d6d61696e26736572766963653d676974687562)](https://coveralls.io/github/tienvx/composer-downloads-plugin?branch=main) [![PHP Version](https://camo.githubusercontent.com/be3d3ca2ac1a8f366e7e5ff5bec97f56d63e2b892f4f02d059b4a843e21a1217/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e302e302b2d6666363962342e737667)](https://packagist.org/packages/tienvx/composer-downloads-plugin)
=====================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#composer-downloads-plugin---)

This plugin allows you to download extra files and extract them within your package.

This is an updated version of [civicrm/composer-downloads-plugin](https://github.com/civicrm/composer-downloads-plugin). It adds support for more archive files and allow custom variables.

Example
-------

[](#example)

Suppose your PHP package `foo/bar` relies on an external archive file (`examplelib-1.1.0-windows-amd64.zip` on Windows, or `examplelib-1.1.0-linux-x86_64.tar.gz` on Linux, or `examplelib-1.1.0-darwin-x86_64.tar.gz` on MacOS):

```
{
  "name": "foo/bar",
  "require": {
    "tienvx/composer-downloads-plugin": "^1.0"
  },
  "extra": {
    "downloads": {
      "examplelib": {
        "url": "https://example.com/examplelib-{$version}-{$os}-{$architecture}.{$extension}",
        "path": "extern/{$id}",
        "version": "1.1.0",
        "variables": {
            "{$os}": "strtolower(PHP_OS_FAMILY)",
            "{$architecture}": "strtolower(php_uname('m'))",
            "{$extension}": "PHP_OS_FAMILY === 'Windows' ? 'zip' : 'tar.gz'",
        },
        "ignore": ["tests", "doc", "*.md"]
      }
    }
  }
}
```

When a downstream user of `foo/bar` runs `composer require foo/bar`, it will download and extract the archive file to `vendor/foo/bar/extern/examplelib`.

Attribute:
----------

[](#attribute)

- `url`: The URL to the extra file.
- `path`: The releative path where content will be extracted.
- `type`: (*Optional*) Determines how the download is handled. If omit, the extension in `url` will be used to detect.

    - Archive types (The archive file `url` will be downloaded and extracted to `path`):
        - `zip`: . Support extension `*.zip`
        - `rar`: Support extension `*.rar`
        - `xz`: Support extension `*.tar.xz`
        - `tar`: Support extensions `*.tar.gz`, `*.tar.bz2`, `*.tar`, `*.tgz`
    - File types (The file `url` will be downloaded and placed at `path`):
        - `file`
        - `phar`: The file will be mark as executable.
        - `gzip`: The `*.gz` file will be extracted to a file that will be placed at `path`.
- `ignore`: (*Optional*) A list of a files that should be omited from the extracted folder.

    - This supports a subset of `.gitignore` notation.
    - Only useful with archive types.
- `executable`: (*Optional*) Indicate list of files should be mark as executable.

    - For archive types: the value should be a list of extracted files
    - For file types: the value should be boolean (true/false)
- `version`: (*Optional*) A version number for the downloaded artifact.

    - This has no functional impact on the lifecycle of the artifact.
    - It can affect the console output.
    - It can be used as a variable.
- `variables`: (*Optional*) List of custom variables.

Variables
---------

[](#variables)

### Supported Attribute

[](#supported-attribute)

Only following attribute support variables:

- `url`
- `path`
- `ignore`

### Default Variables

[](#default-variables)

- `{$id}`: The identifier of the download. (In the example, it would be `examplelib`.)
- `{$version}`: Just a text defined in the `version` attribute, if not defined, the value will be empty string (`""`).

### Custom Variables

[](#custom-variables)

- The format will be `"{$variable-name}": "EXPRESSION-SYNTAX-EVALUATED-TO-STRING"`
- More about the syntax at [Expression Syntax](https://github.com/leongrdic/php-smplang#expression-syntax).
- The syntax must be evaluated into a `string`.

#### Methods

[](#methods)

Custom variable support these methods:

- `range`
- `strtolower`
- `php_uname`
- `in_array`
- `str_contains`
- `str_starts_with`
- `str_ends_with`
- `matches`

#### Constants

[](#constants)

Custom variable support these constants:

- `PHP_OS`
- `PHP_OS_FAMILY`
- `PHP_SHLIB_SUFFIX`
- `DIRECTORY_SEPARATOR`

Default Attributes
------------------

[](#default-attributes)

You may set default attributes for all downloads. Place them under `*`, as in:

```
{
  "extra": {
    "downloads": {
      "*": {
        "path": "bower_components/{$id}",
        "ignore": ["test", "tests", "doc", "docs"],
        "variables": {
          "{$extension}": "zip"
        }
      },
      "jquery": {
        "url": "https://github.com/jquery/jquery-dist/archive/1.12.4.{$extension}"
      },
      "jquery-ui": {
        "url": "https://github.com/components/jqueryui/archive/1.12.1.{$extension}"
      }
    }
  }
}
```

Document
--------

[](#document)

See more at [Doc](./doc/)

Contributing
------------

[](#contributing)

Pull requests are welcome, please [send pull requests](https://github.com/tienvx/composer-downloads-plugin/pulls).

If you found any bug, please [report issues](https://github.com/tienvx/composer-downloads-plugin/issues).

Authors
-------

[](#authors)

- **Rob Bayliss** - [Composer Extra Files](https://github.com/LastCallMedia/ComposerExtraFiles/graphs/contributors)
- **Tim Otten** and contributors - [Composer Download Plugin](https://github.com/civicrm/composer-downloads-plugin/graphs/contributors)
- **Tien Vo** and contributors - [this project](https://github.com/tienvx/composer-downloads-plugin/graphs/contributors)

License
-------

[](#license)

This package is available under the [MIT license](LICENSE).

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 61.1% 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 ~2 days

Recently: every ~8 days

Total

19

Last Release

1224d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/176d0199776bb6cdb210e2c5339ec79637c613e0617377378807bfe051eabb8e?d=identicon)[tien.xuan.vo](/maintainers/tien.xuan.vo)

---

Top Contributors

[![tienvx](https://avatars.githubusercontent.com/u/3327643?v=4)](https://github.com/tienvx "tienvx (102 commits)")[![totten](https://avatars.githubusercontent.com/u/1336047?v=4)](https://github.com/totten "totten (45 commits)")[![rbayliss](https://avatars.githubusercontent.com/u/654407?v=4)](https://github.com/rbayliss "rbayliss (11 commits)")[![mglaman](https://avatars.githubusercontent.com/u/3698644?v=4)](https://github.com/mglaman "mglaman (6 commits)")[![seamuslee001](https://avatars.githubusercontent.com/u/6799125?v=4)](https://github.com/seamuslee001 "seamuslee001 (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tienvx-composer-downloads-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/tienvx-composer-downloads-plugin/health.svg)](https://phpackages.com/packages/tienvx-composer-downloads-plugin)
```

###  Alternatives

[symfony/maker-bundle

Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.

3.4k111.1M568](/packages/symfony-maker-bundle)[symplify/monorepo-builder

Not only Composer tools to build a Monorepo.

5205.3M82](/packages/symplify-monorepo-builder)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

96374.6k23](/packages/friendsoftypo3-content-blocks)[nativephp/desktop

NativePHP for Desktop

34020.6k3](/packages/nativephp-desktop)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)

PHPackages © 2026

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