Composer Post-Install-Cmd Php Script Doesn't Wait for Input

Composer Post-Install-Cmd Php Script Doesn't Wait for Input

So I have a console script i want run after composer has run an install.

"scripts": {
    "post-install-cmd": [
        "php vendor/bin/setup.php"
    ]
}

my setup.php is a CLI script that now looks like

<?php
    echo "something: ";
    $foo = trim(fgets(STDIN));
    echo "you said " . $foo;
?>

When I run php vendor/bin/setup.php manually form the command line - no problems. As expected. However when I run composer install the file executes but STDIN does not wait for a response.

4
Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.