Getting input from stdin during composer installation

By adding a “post-install-cmd” option to your scripts section of composer.json you can setup commands to run after “composer install”, however, these won’t wait for input if you want to collect something (like a username) in a php script.

You can have the exact same effect though by calling the function like so —

"post-install-cmd": [
"MyApp\\Commands\\Class::function"
]

Where Class is your classname and function is a static function that uses stdin to get information.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s