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
Requires
- php: ^8.1
- symfony/console: ^7.3
Requires (Dev)
- phpunit/phpunit: ^11.0
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.lockand 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
1on 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!