PHPackages                             balbuf/drupal-libraries-installer - 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. balbuf/drupal-libraries-installer

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

balbuf/drupal-libraries-installer
=================================

Install Drupal libraries via a simple listing in your composer.json file

v1.0.1(8y ago)13223.4k↓50%6[3 issues](https://github.com/balbuf/drupal-libraries-installer/issues)[1 PRs](https://github.com/balbuf/drupal-libraries-installer/pulls)1MITPHP

Since Jan 25Pushed 5y ago2 watchersCompare

[ Source](https://github.com/balbuf/drupal-libraries-installer)[ Packagist](https://packagist.org/packages/balbuf/drupal-libraries-installer)[ RSS](/packages/balbuf-drupal-libraries-installer/feed)WikiDiscussions master Synced 1mo ago

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

Drupal Libraries Installer
==========================

[](#drupal-libraries-installer)

*Drupal Libraries Installer* is a [composer](https://getcomposer.org/) plugin that allows for easily managing external libraries required for Drupal modules/themes that are not available as composer packages. This plugin is another piece of the puzzle towards managing all external dependencies for a Drupal site in a single place: the `composer.json` file.

How to Use
----------

[](#how-to-use)

1. Add *Drupal Libraries Installer* to your Drupal site project:

    ```
    composer require balbuf/drupal-libraries-installer
    ```
2. Add libraries to your `composer.json` file via the `drupal-libraries` property within `extra`. A library is specified using its name as the key and a URL to its distribution ZIP file as the value:

    ```
    {
        "extra": {
            "drupal-libraries": {
                "flexslider": "https://github.com/woocommerce/FlexSlider/archive/2.6.4.zip",
                "chosen": "https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip"
            }
        }
    }
    ```

    *See below for how to find the ZIP URL for a GitHub repo.*
3. Ensure composer packages of type `drupal-library` are configured to install to the appropriate path. By default, [`composer/installers`](https://packagist.org/packages/composer/installers) (a dependency of this plugin and likely already included in your project) will install these packages to `/libraries/{$name}/` in the root of your repo. You may wish to change this via the `installer-paths` property (within `extra`) of your `composer.json`:

    ```
    {
        "extra": {
            "installer-paths": {
                "web/libraries/{$name}/": ["type:drupal-library"]
            }
        }
    }
    ```

    *See the `composer/installers` [README](https://github.com/composer/installers#custom-install-paths) for more information on the `installer-paths` property.*
4. Run `composer install`. Libraries are downloaded and unpacked into place upon running `composer install` or `composer update`. (To upgrade a library, simply swap out its URL in your `composer.json` file and run `composer install` again.)

How to Reference a GitHub Repo as a ZIP File
--------------------------------------------

[](#how-to-reference-a-github-repo-as-a-zip-file)

If you are directed to download a library from its GitHub repo, follow these instructions to find a link to the ZIP file version of the code base:

### Preferred Method

[](#preferred-method)

It is best to reference a specific release of the library so that the same version of code is downloaded every time for each user of the project. To see what releases are available:

1. Click the `X releases` link (where `X` is some number) near the top of the GitHub repo's home page. You can also reach the release page by appending `/releases/`to the repo's home page URL, e.g. for `https://github.com/harvesthq/chosen`, you'd go to `https://github.com/harvesthq/chosen/releases/`.
2. Identify which release you'd like to use. You'll likely want to use the latest release unless the module noted a specific version requirement.
3. For that release, find the "Assets" section. If the repo provides its own distribution ZIP file, that will be listed as one of the first files in the list. If so, you'll want to try using that first in case it includes pre-built files not available directly in the repo. Otherwise, use the "Source code (zip)" link for that release. Simply copy the URL for the desired link to use within your `composer.json` file.

### Alternate Method

[](#alternate-method)

If the library does not provide any releases, you can still reference it in ZIP file form. The downside is that any time you download this ZIP, the contents may change based on the state of the repo. There is no guarantee that separate users of the project will have the exact same version of the library.

1. Click the green `Clone or download` button on the repo's home page.
2. Copy the URL for the `Download ZIP` link to use within your `composer.json` file.

Notes
-----

[](#notes)

- Only ZIP files are supported at this time.
- This plugin is meant to be used with a root package only (i.e. a Drupal site repo) and will not find libraries listed in the `composer.json` files of dependencies (e.g. contrib modules).
- This plugin is essentially a shortcut for explicitly declaring the composer package information for each library zip you need to include in your project, e.g.: ```
    {
        "repositories": [
            {
                "type": "package",
                "package": {
                    "name": "harvesthq/chosen",
                    "version": "1.8.2",
                    "type": "drupal-library",
                    "dist": {
                      "url": "https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip",
                      "type": "zip"
                    }
                }
            }
        ],
        "require": {
            "harvesthq/chosen": "1.8.2"
        }
    }
    ```

    While that method is perfectly viable and works right out of the box with no additional plugin, it is also cumbersome, not very user-friendly, and quite verbose, adding a lot of additional noise to your `composer.json` file.
- Libraries are installed after actual composer packages are installed and are not subject to the dependency-resolving algorithm inherent to composer. What this means is that libraries cannot be specified with a range of compatible versions (rather, a specific version of a library's distribution file must be chosen), and if libraries have any other additional library dependencies of their own, these must be explicitly added to the list.
- Because libraries are installed after composer packages, it's possible that a library installed by this plugin could overwrite a composer package in the event of an install-path collision.
- While many libraries are JS- and/or CSS-based and available via [npm](https://www.npmjs.com/), there is no way to install these packages directly into the proper /libraries/ folder with npm. As well, modules will often list their external library requirements as links to ZIP distribution files or GitHub repos, making it easier to reference and pull in these dependencies in that manner with this plugin.
- This plugin is intended only as a short-term solution for the broader issue of external library dependency management among modules and themes.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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 ~0 days

Total

2

Last Release

3036d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/19c884fd227b0e179b01fec6ee51c369d9474367efc2330a79951ff77f2b5085?d=identicon)[balbuf](/maintainers/balbuf)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/balbuf-drupal-libraries-installer/health.svg)

```
[![Health](https://phpackages.com/badges/balbuf-drupal-libraries-installer/health.svg)](https://phpackages.com/packages/balbuf-drupal-libraries-installer)
```

###  Alternatives

[drupal/console-extend-plugin

Drupal Console Extend Plugin

13214.3M5](/packages/drupal-console-extend-plugin)[rainlab/blog-plugin

Blog plugin for October CMS

17257.7k](/packages/rainlab-blog-plugin)[php-composter/php-composter

Git Hooks Management through Composer.

10525.1k11](/packages/php-composter-php-composter)[mediawiki/semantic-glossary

A terminology markup extension with a Semantic MediaWiki back-end

1352.4k](/packages/mediawiki-semantic-glossary)[uma/composer-psysh

No-frills PsySH-Composer plugin

183.2k](/packages/uma-composer-psysh)

PHPackages © 2026

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