npm
lets you have something like this:
{
"scripts": {
"start": "babel-node app.js",
}
}
Then when you type npm start
it'll start your app, with whatever command-line options you want. This provides a uniform entry point for all node apps.
Is there anything like that for Composer?
You can add a custom "scripts"
block just like in npm
, but you don't need to preface the command with run
when running the commands. e.g.
{
"name": "vendor/project",
...
"scripts": {
"test": "phpunit"
}
}
With this, you can now run composer test
.
N.B. if you create a script with the same name as a "native" command, you will see this warning:
A script named about would override a native Composer function and has been skipped
However, you can still run the script via composer run-script <script>
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With