Giter Club home page Giter Club logo

composer-suggest's Introduction

Build status — Travis-CI Latest Stable Version MIT License

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

  1. Set an environment variable containing a pattern/keywords in a .env file,

    echo 'NF_COMPOSER_SUGGEST="(EXP|LACE)"' > .env
  2. Require the plugin,

    composer require nfreear/composer-suggest
    
  3. 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.

Caveat utilitor!

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.