composer/composer — pull request #2075 by trompette (2013-07-10 15:16:28+00:00)
Title: [New Command] Licenses of dependencies

At [Alter Way](http://www.alterway.fr/), we need an easy way to check the correct licensing of a project in its entirety; this include checking that every dependency actually has at least one license, that none of these licenses are incompatible with the policy of the final product (e.g. no Affero GPL), etc.

We created a command that generates the list of the licences of the whole tree of depencies used in the project. It currently provides two formats: an easily readable flat one (default) and a json one, easier to process programmaticaly.

The flat output looks like this:

```
$ php bin/composer licenses --format flat
Root Package:
composer/composer 1.0.x-dev MIT
Dependencies:
justinrainbow/json-schema 1.1.0 none
phpunit/php-code-coverage 1.2.9 BSD-3-Clause
phpunit/php-file-iterator 1.3.3 BSD-3-Clause
phpunit/php-text-template 1.1.4 BSD-3-Clause
phpunit/php-timer 1.0.4 BSD-3-Clause
phpunit/php-token-stream 1.1.5 BSD-3-Clause
phpunit/phpunit 3.7.19 BSD-3-Clause
phpunit/phpunit-mock-objects 1.2.3 BSD-3-Clause
seld/jsonlint 1.1.1 MIT
symfony/console dev-master 23d784f MIT
symfony/finder v2.2.1 MIT
symfony/process dev-master 9b6fe3a MIT
symfony/yaml v2.2.1 MIT
```

The json one looks like that:
```
$ php bin/composer licenses --format json
{"name":"composer\/composer","version":"1.0.x-dev","license":["MIT"],"dependencies":{"justinrainbow\/json-schema":{"version":"1.1.0","license":[]},"phpunit\/php-code-coverage":{"version":"1.2.9","license":["BSD-3-Clause"]},"phpunit\/php-file-iterator":{"version":"1.3.3","license":["BSD-3-Clause"]},"phpunit\/php-text-template":{"version":"1.1.4","license":["BSD-3-Clause"]},"phpunit\/php-timer":{"version":"1.0.4","license":["BSD-3-Clause"]},"phpunit\/php-token-stream":{"version":"1.1.5","license":["BSD-3-Clause"]},"phpunit\/phpunit":{"version":"3.7.19","license":["BSD-3-Clause"]},"phpunit\/phpunit-mock-objects":{"version":"1.2.3","license":["BSD-3-Clause"]},"seld\/jsonlint":{"version":"1.1.1","license":["MIT"]},"symfony\/console":{"version":"dev-master 23d784f","license":["MIT"]},"symfony\/finder":{"version":"v2.2.1","license":["MIT"]},"symfony\/process":{"version":"dev-master 9b6fe3a","license":["MIT"]},"symfony\/yaml":{"version":"v2.2.1","license":["MIT"]}}}
```