{"id":14968744,"url":"https://github.com/zodiacmedia/drupal-libraries-installer","last_synced_at":"2025-10-26T05:30:45.553Z","repository":{"id":43463127,"uuid":"260410404","full_name":"zodiacmedia/drupal-libraries-installer","owner":"zodiacmedia","description":"Install Drupal libraries via a simple listing in your composer.json file","archived":false,"fork":false,"pushed_at":"2025-08-08T08:54:25.000Z","size":70,"stargazers_count":6,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-10-13T07:38:39.873Z","etag":null,"topics":["composer","composer-plugin","downloader","drupal","drupal-plugin","libraries","php"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/zodiacmedia/drupal-libraries-installer","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zodiacmedia.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-01T08:18:41.000Z","updated_at":"2025-08-08T08:53:00.000Z","dependencies_parsed_at":"2024-09-27T10:41:23.949Z","dependency_job_id":"e0c6c11c-4c12-46f7-8e9a-8e61a2dfa977","html_url":"https://github.com/zodiacmedia/drupal-libraries-installer","commit_stats":{"total_commits":17,"total_committers":4,"mean_commits":4.25,"dds":0.5882352941176471,"last_synced_commit":"31bca11d4181d654e33bfc48f7f5fd0a2c473571"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/zodiacmedia/drupal-libraries-installer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodiacmedia%2Fdrupal-libraries-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodiacmedia%2Fdrupal-libraries-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodiacmedia%2Fdrupal-libraries-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodiacmedia%2Fdrupal-libraries-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zodiacmedia","download_url":"https://codeload.github.com/zodiacmedia/drupal-libraries-installer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zodiacmedia%2Fdrupal-libraries-installer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281060124,"owners_count":26437156,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-26T02:00:06.575Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["composer","composer-plugin","downloader","drupal","drupal-plugin","libraries","php"],"created_at":"2024-09-24T13:40:29.060Z","updated_at":"2025-10-26T05:30:45.159Z","avatar_url":"https://github.com/zodiacmedia.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Drupal Libraries Installer\n\n_Drupal Libraries Installer_ is a [composer][composer] plugin that allows for easily\nmanaging external libraries required for Drupal modules/themes that are not available\nas composer packages. This plugin is another piece of the puzzle towards managing all\nexternal dependencies for a Drupal site in a single place: the `composer.json` file.\n\n## How to Use\n\n1. Add _Drupal Libraries Installer_ to your Drupal site project:\n\n    ```sh\n    composer require zodiacmedia/drupal-libraries-installer\n    ```\n\n1. Add libraries to your `composer.json` file via the `drupal-libraries` property\nwithin `extra`. A library is specified using its name as the key and a URL to \nits distribution ZIP/RAR/TAR/TGZ/TAR.GZ/TAR.BZ2 file as the value.\nIt'll attempt to guess the library type from the URL.\nIf the file is not a ZIP file, then the URL must end with the file extension:\n\n    ```json\n    {\n        \"extra\": {\n            \"drupal-libraries\": {\n                \"chosen\": \"https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip\",\n                \"flexslider\": \"https://github.com/woocommerce/FlexSlider/archive/2.6.4.zip\",\n                \"moment\": \"https://registry.npmjs.org/moment/-/moment-2.25.0.tgz\"\n            }\n        }\n    }\n    ```\n\n    Or alternatively if you want to specify a more detailed definition:\n\n    ```json\n    {\n        \"extra\": {\n            \"drupal-libraries\": {\n                \"chosen\": {\n                    \"url\": \"https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip\"\n                },\n                \"flexslider\": {\n                    \"url\": \"https://github.com/woocommerce/FlexSlider/archive/2.6.4.zip\",\n                    \"version\": \"2.6.4\",\n                    \"type\": \"zip\",\n                    \"ignore\": [\"bower_components\", \"demo\", \"node_modules\"]\n                },\n                \"moment\": {\n                    \"url\": \"https://registry.npmjs.org/moment/-/moment-2.25.0.tgz\",\n                    \"shasum\": \"e961ab9a5848a1cf2c52b1af4e6c82a8401e7fe9\"\n                },\n                \"select2\": {\n                     \"url\": \"https://github.com/select2/select2/archive/4.0.13.zip\",\n                     \"ignore\": [\n                         \".*\",\n                         \"*.{md}\",\n                         \"Gruntfile.js\",\n                         \"{docs,src,tests}\"\n                     ],\n                     \"rename\": {\n                         \"dist\": \"build\"                  \n                     }                   \n                },\n                \"custom-tar-asset\": {\n                     \"url\": \"https://assets.custom-url.com/unconventional/url/path\",\n                     \"type\": \"tar\",\n                     \"ignore\": [\".*\", \"*.{txt,md}\"]\n                }\n            }\n        }\n    }\n    ```\n\n   Where the configuration options are as follows:\n   - `url`: The library URL (mandatory).\n   - `version`: The version of the library (defaults to `1.0.0`).\n   - `type`: The type of library archive, one of (zip, tar, rar, gzip), support depends on your composer version (defaults to `zip`). \n   - `ignore`: Array of folders/file globs to remove from the library (defaults to `[]`). See [PSA-2011-002](https://www.drupal.org/node/1189632).\n   - `rename`: Object mapping of folders/files to rename to fit a certain folder structure (optional).\n   - `shasum`: The SHA1 hash of the asset (optional).\n\n    _See below for how to find the ZIP URL for a GitHub repo._\n\n1. Ensure composer packages of type `drupal-library` are configured to install to the\nappropriate path. By default, [`composer/installers`][installers] (a dependency of\nthis plugin and likely already included in your project) will install these packages\nto `/libraries/{$name}/` in the root of your repo. You may wish to change this via\nthe `installer-paths` property (within `extra`) of your `composer.json`:\n\n    ```json\n    {\n        \"extra\": {\n            \"installer-paths\": {\n                \"web/libraries/{$name}/\": [\"type:drupal-library\"]\n            }\n        }\n    }\n    ```\n\n    _See the `composer/installers` [README][installers readme] for more information on\n    the `installer-paths` property._\n\n1. Run `composer install`. Libraries are downloaded and unpacked into place upon running\n`composer install` or `composer update`. (To upgrade a library, simply swap out its URL\nin your `composer.json` file and run `composer install` again.)\n\n## Installing libraries declared by other packages.\n\nSet the `drupal-libraries-dependencies` extra property to `true` to fetch libraries\ndeclared by all the packages in your project. Only the first declaration of the \nlibrary is ever used, so if you find that multiple packages require different\nversions of the same library, you can declare the correct version in the \nproject's `composer.json`.\n\n```json\n{\n    \"extra\": {\n        \"drupal-libraries-dependencies\": true\n    }\n}\n```\n\nAlternatively you can restrict it to specific packages (recommended) by setting\nit to an array of packages which you'd like to pull in libraries for.\n\n```json\n{\n    \"extra\": {\n        \"drupal-libraries-dependencies\": [\n          \"drupal/project1\",\n          \"drupal/project2\"\n        ]\n    }\n}\n```\n\n## How to reference an npm package.\n\nFor example, if you're interested in downloading version 2.25.0 of the \n[`moment`](https://www.npmjs.com/package/moment) npm package.\n\n- Run `npm view moment@2.25.0`.\n- Use the `.tarball` value as the library `url`.\n- Use the `.shasum` value as the library `shasum`.\n\n## How to Reference a GitHub Repo as a ZIP File\n\nIf you are directed to download a library from its GitHub repo, follow these instructions\nto find a link to the ZIP file version of the code base:\n\n### Preferred Method\n\nIt is best to reference a specific release of the library so that the same version of\ncode is downloaded every time for each user of the project. To see what releases are\navailable:\n\n1. Click the `X releases` link (where `X` is some number) near the top of the\nGitHub repo's home page. You can also reach the release page by appending `/releases/`\nto the repo's home page URL, e.g. for `https://github.com/harvesthq/chosen`, you'd\ngo to `https://github.com/harvesthq/chosen/releases/`.\n\n1. Identify which release you'd like to use. You'll likely want to use the latest release\nunless the module noted a specific version requirement.\n\n1. For that release, find the \"Assets\" section. If the repo provides its own distribution\nZIP file, that will be listed as one of the first files in the list. If so, you'll want to\ntry using that first in case it includes pre-built files not available directly in the repo.\nOtherwise, use the \"Source code (zip)\" link for that release. Simply copy the URL for the\ndesired link to use within your `composer.json` file.\n\n### Alternate Method\n\nIf the library does not provide any releases, you can still reference it in ZIP file form.\nThe downside is that any time you download this ZIP, the contents may change based on the\nstate of the repo. There is no guarantee that separate users of the project will have the\nexact same version of the library. To mitigate against this issue, you should\nalways download a specific commit version rather than from a branch like `master`.\n\n1. Click the green `Clone or download` button on the repo's home page.\n\n1. Copy the URL for the `Download ZIP` link to use within your `composer.json` file.\n\n### Library definitions with namespaces\n\nIf a library includes a vendor namespace, then its internal package name\nwill be prefixed with a `drupal-library_` e.g. `vendor/library` becomes\n`drupal-library_vendor/library`, which in turn allows you to add a\ncustom installer option like the following to manage where it's downloaded:\n```json5\n{\n  // composer.json\n  \"extra\": {\n    \"installer-paths\": {\n      // Custom installer path entry to store them all under the same folder.\n      \"web/libraries/myvendor/{$name}\": [\n        \"vendor:drupal-library_ckeditor\"\n      ],\n      \"web/libraries/{$name}/\": [\n        \"type:drupal-library\"\n      ]\n    },\n    \"drupal-libraries\": {\n      \"myvendor/package1\": \"https://download.myvendor.com/package1-1.0.0.zip\",\n      \"myvendor/package2\": \"https://download.myvendor.com/package2-1.4.0.zip\"\n    }\n  },\n}\n```\n\nOtherwise the files will be stored in `web/libraries/myvendor` by default and\nwill overwrite each other.\n\n**NB**: The order of the `installer-paths` matters.\n\nThe justification behind the prefix is to avoid any potential collision with\nnormal composer packages.\n\n## Notes\n\n- This plugin is essentially a shortcut for explicitly declaring the composer package\ninformation for each library zip you need to include in your project, e.g.:\n    ```json\n    {\n        \"repositories\": [\n            {\n                \"type\": \"package\",\n                \"package\": {\n                    \"name\": \"harvesthq/chosen\",\n                    \"version\": \"1.8.2\",\n                    \"type\": \"drupal-library\",\n                    \"dist\": {\n                      \"url\": \"https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip\",\n                      \"type\": \"zip\"\n                    }\n                }\n            }\n        ],\n        \"require\": {\n            \"harvesthq/chosen\": \"1.8.2\"\n        }\n    }\n    ```\n    While that method is perfectly viable and works right out of the box with no additional\n    plugin, it is also cumbersome, not very user-friendly, and quite verbose, adding\n    a lot of additional noise to your `composer.json` file.\n- Libraries are installed after actual composer packages are installed and are not\nsubject to the dependency-resolving algorithm inherent to composer. What this means\nis that libraries cannot be specified with a range of compatible versions (rather,\na specific version of a library's distribution file must be chosen), and if libraries\nhave any other additional library dependencies of their own, these must be explicitly\nadded to the list.\n- Because libraries are installed after composer packages, it's possible that a library\ninstalled by this plugin could overwrite a composer package in the event of an\ninstall-path collision.\n- While many libraries are JS- and/or CSS-based and available via [npm][npm], there is\nno way to install these packages directly into the proper /libraries/ folder with npm.\nAs well, modules will often list their external library requirements as links to ZIP\ndistribution files or GitHub repos, making it easier to reference and pull in these\ndependencies in that manner with this plugin.\n\n[composer]: https://getcomposer.org/\n[npm]: https://www.npmjs.com/\n[installers]: https://packagist.org/packages/composer/installers\n[installers readme]: https://github.com/composer/installers#custom-install-paths\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzodiacmedia%2Fdrupal-libraries-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzodiacmedia%2Fdrupal-libraries-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzodiacmedia%2Fdrupal-libraries-installer/lists"}