From b82a96405d6681d74beb4bc75fd8a5ce1f853461 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Sun, 22 Dec 2019 12:32:04 +0100 Subject: [PATCH] Add @putenv to docs, refs #8492 --- doc/articles/scripts.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/doc/articles/scripts.md b/doc/articles/scripts.md index 38f6861b6..d51d01c75 100644 --- a/doc/articles/scripts.md +++ b/doc/articles/scripts.md @@ -342,6 +342,21 @@ JSON array of commands. You can also call a shell/bash script, which will have the path to the PHP executable available in it as a `PHP_BINARY` env var. +## Setting environment variables + +To set an environment variable in a cross-platform way, you can use `@setenv`: + +```json +{ + "scripts": { + "install-phpstan": [ + "@putenv COMPOSER=phpstan-composer.json", + "composer install --prefer-dist" + ] + } +} +``` + ## Custom descriptions. You can set custom script descriptions with the following in your `composer.json`: