2017 © Pedro Peláez
 

composer-plugin custom-installer

Install custom types into custom locations.

image

davidbarratt/custom-installer

Install custom types into custom locations.

  • Saturday, January 23, 2016
  • by davidbarratt
  • Repository
  • 6 Watchers
  • 27 Stars
  • 114,343 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 6 Forks
  • 1 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

Composer Custom Type Installer

Build Status, (*1)

Adds a root-level custom type installer path to composer.json. Any custom type can be used to define a path the type should be installed in., (*2)

Installation

Simply require this library in your composer.json file. Typically this will be added as a dependency of the custom type to ensure that the library is loaded before the library that needs it. However, this can be added to the root composer.json, as long as it goes before any library that needs it., (*3)

{
    "require": {
        "davidbarratt/custom-installer": "1.0.*@dev"
    }
}

Usage

The added parameter(s) are only allowed on the root to avoid conflicts between multiple libraries. This also prevents a project owner from having a directory accidentally wiped out by a library. Note: Each package will go in it’s respective folder in the order in which they are installed., (*4)

The configuration has to be added in custom-installer of composer.json's extra section. It is similar to Composer installer's installation paths., (*5)

Pattern syntax

The key of the the configuration array is the path pattern. You can use some replacement tokens:, (*6)

  • {$name}: The name of the package (e.g. yaml of symfony/yaml)
  • {$vendor}: The vendor of the package (e.g. symfony of symfony/yaml)
  • {$type}: for the composer package type (e.g. library, drupal-module)

Package filters

The value of the configuration array has to be an array. It holds the package filter for the given pattern. The pattern will be applied if any filter matches., (*7)

Package type filter

With type:[package-type] you can define a pattern per package type. You can use any custom package type and are not limited to a predefined set., (*8)

Composer specific package types metapackage or composer-plugin will never be handled by Custom Installer., (*9)

Example: type:custom-library for package type custom-library, (*10)

Package name filter

You can specify a pattern per full package name ([vendor]/[name])., (*11)

Custom Installer will only handle a specific package if a configuration exists that also handles the package type in general., (*12)

Examples

{
    "extra": {
        "custom-installer": {
            "web/": ["type:drupal-core"],
            "web/sites/{$name}/": ["type:drupal-site"],
            "custom/{$type}/{$vendor}/{$name}/": ["type:random-type"],
            "vendor/{$vendor}/{$name}/": ["type:library"],
            "web/sites/all/libraries/{$name}/": [
                "type:component",
                "ckeditor/ckeditor",
                "flesler/jquery.scrollto"
            ],
            "custom-folder-for-single-package": ["myvendorname/single-package"],
        }
    }
}

In the example we want to make sure CKEditor and Jquery ScrollTo will be placed in web/sites/all/libraries. Both packages are of of package type library. In order to change the path of those packages, we must declare a fallback for the package type library. It shall stay in the default vendor location (as library is the default composer package type). If you do not do that the custom installer cannot handle the single packages (ckeditor and flesler/jquery.scrollto ) due to the way composer installer plugins work., (*13)

The Versions

23/01 2016

dev-master

9999999-dev https://github.com/davidbarratt/custom-installer

Install custom types into custom locations.

  Sources   Download

Apache-2.0

The Requires

  • composer-plugin-api ~1.0

 

The Development Requires

23/01 2016

dev-develop

dev-develop https://github.com/davidbarratt/custom-installer

Install custom types into custom locations.

  Sources   Download

Apache-2.0

The Requires

  • composer-plugin-api ~1.0

 

The Development Requires

23/01 2016

1.0.0-alpha2

1.0.0.0-alpha2 https://github.com/davidbarratt/custom-installer

Install custom types into custom locations.

  Sources   Download

Apache-2.0

The Requires

  • composer-plugin-api ~1.0

 

The Development Requires

01/09 2014

1.0.0-alpha1

1.0.0.0-alpha1 https://github.com/davidbarratt/custom-installer

Install custom types into custom locations.

  Sources   Download

Apache-2.0

The Requires

  • composer-plugin-api 1.0.0

 

The Development Requires