{"id":20945844,"url":"https://github.com/balbuf/drupal-libraries-installer","last_synced_at":"2025-05-14T01:31:47.530Z","repository":{"id":55625296,"uuid":"118845810","full_name":"balbuf/drupal-libraries-installer","owner":"balbuf","description":"Install Drupal libraries via a simple listing in your composer.json file","archived":false,"fork":false,"pushed_at":"2020-12-17T09:20:44.000Z","size":9,"stargazers_count":13,"open_issues_count":7,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-17T23:43:01.426Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/balbuf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-25T01:36:28.000Z","updated_at":"2023-05-29T15:51:21.000Z","dependencies_parsed_at":"2022-08-15T04:50:16.878Z","dependency_job_id":null,"html_url":"https://github.com/balbuf/drupal-libraries-installer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balbuf%2Fdrupal-libraries-installer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balbuf%2Fdrupal-libraries-installer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balbuf%2Fdrupal-libraries-installer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/balbuf%2Fdrupal-libraries-installer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/balbuf","download_url":"https://codeload.github.com/balbuf/drupal-libraries-installer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225269808,"owners_count":17447594,"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","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":[],"created_at":"2024-11-18T23:50:32.163Z","updated_at":"2024-11-18T23:50:32.661Z","avatar_url":"https://github.com/balbuf.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 balbuf/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 its\ndistribution ZIP file as the value:\n\n    ```json\n    {\n        \"extra\": {\n            \"drupal-libraries\": {\n                \"flexslider\": \"https://github.com/woocommerce/FlexSlider/archive/2.6.4.zip\",\n                \"chosen\": \"https://github.com/harvesthq/chosen/releases/download/v1.8.2/chosen_v1.8.2.zip\"\n            }\n        }\n    }\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## 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.\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## Notes\n\n- Only ZIP files are supported at this time.\n- This plugin is meant to be used with a root package only (i.e. a Drupal site repo)\nand will not find libraries listed in the `composer.json` files of dependencies\n(e.g. contrib modules).\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- This plugin is intended only as a short-term solution for the broader issue of\nexternal library dependency management among modules and themes.\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%2Fbalbuf%2Fdrupal-libraries-installer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbalbuf%2Fdrupal-libraries-installer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbalbuf%2Fdrupal-libraries-installer/lists"}