selfphp/composer-license-audit

Automated license audit tool for Composer dependencies with blacklist and CI integration.

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/selfphp/composer-license-audit

1.0.0 2025-06-07 20:06 UTC

This package is auto-updated.

Last update: 2025-12-07 21:06:25 UTC


README

A simple and powerful CLI tool to analyze Composer dependencies for license compliance.
Useful for companies, open-source maintainers, and CI/CD pipelines.

๐Ÿš€ Features

  • ๐Ÿ” Parses composer.lock and detects licenses
  • โŒ Compares against a blacklist (config/blacklist.json)
  • โœ… Supports per-package exceptions (config/allowed-packages.json)
  • ๐Ÿ“Š CSV and JSON export
  • ๐Ÿงช CI-friendly: exits with code 1 on violations

๐Ÿ“ฆ Installation

composer require --dev selfphp/composer-license-audit

Or install globally:

composer global require selfphp/composer-license-audit

๐Ÿ”ง Configuration

config/blacklist.json

{
  "forbidden": [
    "AGPL-3.0",
    "GPL-3.0-only",
    "GPL-3.0-or-later",
    "CC-BY-SA-4.0"
  ]
}

config/allowed-packages.json

{
  "exceptions": [
    "legacy/package",
    "acme/unstable-lib"
  ]
}

๐Ÿง‘โ€๐Ÿ’ป Usage

Basic scan:

vendor/bin/license-audit

With CSV + CI check:

vendor/bin/license-audit \
  --fail-on-blacklist \
  --csv=report/licenses.csv

With custom paths:

vendor/bin/license-audit \
  --lockfile=/custom/path/composer.lock \
  --blacklist=config/blacklist.json

๐Ÿ“Š Example Output

Package                        License                   Status
symfony/console                MIT                       OK
some/forbidden-lib             AGPL-3.0                  VIOLATION

โœ… Exit Codes

Code Meaning
0 No violations
1 At least one violation

๐Ÿงช CI/CD Integration

GitHub Actions:

- name: Check Composer Licenses
  run: vendor/bin/license-audit --fail-on-blacklist

๐Ÿงช CI Integration Examples

Example configuration files for popular CI providers are available in docs/ci/:

๐Ÿ‘ค Author

Damir Enseleit
GitHub: @selfphp
Website: https://selfphp.de

๐Ÿค Contributing

Found a bug or have a feature request?
Feel free to open an issue or submit a pull request. Contributions are welcome!

๐Ÿ“„ License

MIT โ€“ use it, fork it, improve it!

Feel free to contribute!