php - Good practice for composer scripts arguments
one text
I just created a simple script which is supposed to be called with composer. So, I passed some arguments to my command line line
composer deploySources -- $SSH_HOST $SSH_USER $SSH_PASSWORD
But, by doing this way, I can only pass arguments in a specific order and I find it a bit messy.
And I find the command line not really explicit aswell.
So I decided to do it this way:
composer deploySources -- server=$SSH_HOST login=$SSH_USER password=$SSH_PASSWORD directory=$SOURCE_PATH
And then, create a small tool to explode all my arguments and returns me an associative array like :
["server" => "foo", "login" => "bar" ...]
It's ok, the job is done this way but now, I'm asking myself.
Is it the good way to do, or am I missing something in the composer documentation?
Source