Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Emanuele Minotto:
About Composer commands
Nov 11, 2015 @ 16:50:38

In this post to his site Emanuele Minotto looks at commands in Composer. This functionality lets you execute "commands" with Composer command line options. These are not the same as the "scripts" functionality that allows you to specify shell commands to execute when certain events are fired.

Recently I’m considering a not-so-common Composer feature: commands (scripts). Composer already provides some hooks, you can find the list of provided hooks here: getcomposer.org/doc/articles/scripts.md#event-names

These hooks you see aren’t the same commands I mean in this article, because can’t be invoked using "composer post-install-cmd", I’m going to list some scripts I found useful, but before let me explain some reasons why I think they should be included in your composer.json.

He starts by answering a few of the common questions about this command handling including how it should be done can be tested. He then covers three commands you can use to help with testing these commands:

  • composer test
  • composer compile
  • composer check-style

For each he provides an example of the configuration in the "scripts" section of the composer.json file when each of these special command line options are used.

tagged: composer commands test compile checkstyle

Link: http://emanueleminotto.github.io/blog/about-composer-commands/


Trending Topics: