nfreear / composer-suggest
Composer plugin to install a custom group of suggested packages, based on keyword patterns. ' vi .env && composer install '
Installs: 329
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 3
Forks: 1
Open Issues: 8
Type:composer-plugin
Requires
- php: >=5.3.3
- composer-plugin-api: ^1.0
- vlucas/phpdotenv: ^2.4
Requires (Dev)
- composer/composer: ^1.0
- jakub-onderka/php-parallel-lint: ^0.9.2
- squizlabs/php_codesniffer: 2.8.1
Suggests
- a/b: 1.0; This package is for [LACE] only
- phpunit/phpunit: ~4.0
- wikimedia/composer-merge-plugin: *; Merge one or more additional composer.json files at runtime [LACE]
This package is not auto-updated.
Last update: 2024-11-09 18:27:22 UTC
README
composer-suggest
A Composer plugin to install a custom group of suggested packages, based on keyword patterns. (Caution)
Example composer.json
:
{ "suggest": { "a/b": "1.0; This package is for [LACE] only", "c/d": "2.1, This package is for JuxtaLearn and LACE.", "e/f": "3.2, This is just for [JXL].", "g/h": "1.0-beta; Experiment-A" } }
Usage
-
Set an environment variable containing a pattern/keywords in a
.env
file,echo 'NF_COMPOSER_SUGGEST="(EXP|LACE)"' > .env
-
Require the plugin,
composer require nfreear/composer-suggest
-
Install as you would normally (verbose),
composer -vvv install
Legacy
In Composer script mode, an example composer.json
might contain:
{ "suggest": { "a/b": "1.0; This package is for [LACE] only", "c/d": "2.1, This package is for JuxtaLearn and LACE.", "e/f": "3.2, This is just for [JXL].", "g/h": "1.0-beta; Experiment-A" }, "scripts": { "dry-run-suggest": "\\Nfreear\\Composer\\Suggest::dryRun", "install-suggest": "\\Nfreear\\Composer\\Suggest::install", "install-lace": "./vendor/bin/suggest --dry LACE" } }
Legacy usage:
> composer -v install-lace
Legacy advanced usage:
> composer -v dry-run-suggest "Ju?X(ta)?L" # Packages suggested for 'Juxtalearn' & 'JXL'. > composer -v dry-run-suggest "Experiment-A"
Test
composer test
Caution
Use of the composer-suggest
plugin implies that you probably won't commit composer.lock
to version control. Various people say this is bad, and as a general rule they are probably correct.
Composer-suggest works well when all/most of the dependencies in require
and suggest
have precise version constraints (1.2.3
) as opposed to loose ones (1.*
, >= 1.5
..).
It is also useful during rapid development phases of a project. See it in use in the LACE/ OER Research Hub code, and Open Media Player code-base.
Developed for the LACE Evidence Hub, part of the Learning Analytics Community Exchange project.
Inspired by and based in part on the composer-merge-plugin – thank you!
License: MIT
© 2016 The Open University. (Institute of Educational Technology)