selfphp/composer-license-audit
最新稳定版本:1.0.0
Composer 安装命令:
composer require selfphp/composer-license-audit
包简介
Automated license audit tool for Composer dependencies with blacklist and CI integration.
README 文档
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!
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-07