#13038·composer

Options don't get passed to scripts as additional arguments

Author: JKingwebCreated Aug 14, 2026Updated Aug 19, 2026

My composer.json:

json
{
    "name": "test/test",
    "version": "0.0.0",
    "license": "CC0-1.0",
    "scripts": {
        "test": ["echo foo bar"]
    }
}

Output of composer diagnose:

bash
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking Composer version: OK
Composer version: 2.10.2
Checking Composer and its dependencies for vulnerabilities: OK
PHP version: 8.5.9
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 3.6.3 9 Jun 2026
curl version: 8.21.0 libz 1.3.2 brotli brotli/1.2.0 zstd supported ssl OpenSSL/3.6.3 HTTP 1.0, 1.1, 2, 3
zip: extension not loaded, unzip present, 7-Zip present (7z)
Active plugins: 
Checking composer.json: WARNING
The version field is present, it is recommended to leave it out if the package is published on Packagist.
Checking composer.lock: OK
Checking platform settings: OK
Checking git settings: OK git version 2.55.0
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com oauth access: OK does not expire
Checking disk free space: OK

When I run this command:

composer test baz --quux
composer test baz -q

I get the following output:

foo bar baz
foo bar baz

And I expected this to happen:

foo bar baz --quux
foo bar baz -q

Documentation suggests options should get passed as with other arguments:

When running scripts like composer script-name arg arg2 or composer script-name -- --option, Composer will by default append arg, arg2 and --option to the script's command.