dominikb/composer-license-checker
Composer 安装命令:
composer require dominikb/composer-license-checker
包简介
Utility to check for licenses of dependencies and block/allow them.
README 文档
README
Quickly scan your dependencies, see what licenses they use or check in your CI that no unwanted licenses were merged.
The lookup of the summaries for every license done on https://tldrlegal.com/.
Please inform yourself in more detail about the licenses you use and do not use the provided summary as your sole information.
Installation
You can install the package via composer:
composer require --dev dominikb/composer-license-checker
Usage
These commands are available:
./composer-license-checker report- Create a report of all dependencies and their licenses./composer-license-checker init- Generate anallowlist.txtwith all licenses found in your dependencies./composer-license-checker check- Check if any dependency violates your allowlist or blocklist
Use ./composer-license-checker help to get info about general usage or use the syntax ./composer-license-checker help COMMAND_NAME to see more information about a specific command available.
./vendor/bin/composer-license-checker report -p /path/to/your/project -c /path/to/composer.phar
./vendor/bin/composer-license-checker check \
--allowlist allowlist.txt \ # Use the generated allowlist
--allowlist MIT \ # Fail if anything but MIT license is used
--blocklist GPL \ # Fail if any dependency uses GPL
--allow dominikb/composer-license-checker # Always allow this dependency regardless of its license
Shared allowlist/blocklist
When using a filesource for your allowlist or blocklist you can also fetch them from a URI.
# Using a publicly available allowlist
./composer-license-checker check \
--allowlist https://gist.githubusercontent.com/dominikb/671874857463bb08bab094edde20b8ca/raw/d415a9f96d9101205054e685eb61674393214b3f/allowlist.txt
Path to composer
By default, this tool assumes that "composer" is in your path and a valid command that will call Composer.
If that isn't the case, add the -c or --composer option with the path where to find Composer instead.
This tool comes with Composer installed as a dependency, so you may start with --composer ./vendor/bin/composer, given that you are in this tool's root directory when executing a license check.
If this tool cannot find Composer, it will exit with status code 2, see below.
Exit codes
Any command returns with one of these exit codes:
- 0: Ok
- 1: Offending licenses found in check, or a problem occurred when creating a report
- 2: Internal error when executing the command, may indicate problems calling Composer internally
Dependencies without a license
Some dependencies might not have a license specified in their composer.json.
Those will be grouped under the license none.
# Reporting a dependency without a license will look like this ./composer-license-checker report --show-packages # Count 1 - none (-) # +-----+---------+------+ # | CAN | CAN NOT | MUST | # +-----+---------+------+ # # packages: somepackage/without-a-license
You can add the imagined license none to your allowlist or blocklist to handle those dependencies.
# Allow dependencies without a license ./composer-license-checker check --allowlist none # Disallow dependencies without a license ./composer-license-checker check --allowlist GPL --blocklist none
Testing
composer test
Code coverage reports are output to the build folder. See .phpunit.xml.dist for more testing configuration.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email bauernfeind.dominik@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
dominikb/composer-license-checker 适用场景与选型建议
dominikb/composer-license-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.74M 次下载、GitHub Stars 达 58, 最近一次更新时间为 2019 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「dominikb」 「composer-license-checker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dominikb/composer-license-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dominikb/composer-license-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.74M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 58
- 点击次数: 19
- 依赖项目数: 7
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2019-03-24