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 @ 10: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/

Sebastian Bergmann's Blog:
Using HipHop for Static Analysis
Jul 27, 2010 @ 10:13:51

In a new blog entry today Sebastian Bergmann quickly shows a method of performing some code analysis on code transformed by HipHop for PHP.

HipHop for PHP, the source code transformer that turns PHP code into C++ code that can then be compiled with g++, can also be used for static code analysis to find problems in PHP source code.

He includes a script that creates an XML document that both Checkstyle and PHP_CodeSniffer can use to check for a valid format on his sample "CodeErrors.js" file. He includes the script to create this XML file.

tagged: hiphop xml compile phpcodesniffer checkstyle