Download the PHP package villfa/composer-substitution-plugin without Composer

On this page you can find all versions of the php package villfa/composer-substitution-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package composer-substitution-plugin

Composer Substitution Plugin

The Composer Substitution plugin replaces placeholders in the scripts section by dynamic values.

It also permits to cache these values during the command execution and adds the ability to escape them with the function of your choice.

Build Status AppVeyor Build Status Latest Stable Version Minimum PHP Version

Installation

Requirements

Usage

You need to configure the plugin in the extra section of composer.json.

Here an example:

Then you can add the configured placeholders in the scripts section:

And now if you run the command:

Configuration

Configuration key Mandatory Type Default value Description
extra.substitution.enable no bool true with Composer 2.2+, false otherwise Disables the plugin when false
extra.substitution.mapping yes object empty object Mapping between placeholders (the keys) and substitution rules (the values). There is no restriction with the placeholders format.
extra.substitution.mapping.*.type yes string n/a Substitution type (see the related section below)
extra.substitution.mapping.*.value yes string n/a Substitution value (depends on the type)
extra.substitution.mapping.*.cached no bool false Indicates whether the value provided after the first substitution must be cached
extra.substitution.mapping.*.escape no string null Escaping function that will receive the substitute value as argument
extra.substitution.priority no integer 0 Plugin's event handler priority (see Composer documentation)
:warning: From Composer 2.2+ you'll have to configure your composer.json file to allow the plugin to run

Example:

You can just execute this command:

For more details, see https://getcomposer.org/doc/06-config.md#allow-plugins

Substitution types

For each type of substitution the value replacing the placeholder comes from a different source.

Real-life examples

PHPUnit Extra Constraints

This library defines a Composer script which uses PHP_CodeSniffer this way:

Unfortunately it is not cross-platform because of the usage of nproc.

This is solved by the substitution plugin in combination with Linfo (See also the tiny script nproc.php). Here how it is configured:

So now it also works on Windows without even touching the scripts section.


All versions of composer-substitution-plugin with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3.2
ext-ctype Version *
ext-json Version *
composer-plugin-api Version ^1.0 || ^2.0
psr/log Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package villfa/composer-substitution-plugin contains the following files

Loading the files please wait ....