lendable/composer-license-checker
Composer 安装命令:
composer create-project lendable/composer-license-checker
包简介
Composer license checker
README 文档
README
This library provides tooling to check licensing of dependencies against a set of rules to ensure compliance with open source licenses and minimize legal risk. It helps you to keep track of licenses of dependencies in use and make informed decisions on their usage.
Installation
composer require --dev lendable/composer-license-checker
Usage
Create a configuration file in your project root, .allowed-licenses.php (or you can use the option -a / --allow-file to specify the location of the configuration).
<?php declare(strict_types=1); use Lendable\ComposerLicenseChecker\LicenseConfigurationBuilder; return (new LicenseConfigurationBuilder()) ->addLicenses( 'MIT', 'BSD-2-Clause', 'BSD-3-Clause', 'Apache-2.0', // And other licenses you wish to allow. ) ->addAllowedVendor('vendor_name') // Allow any license from a specific vendor, i.e. your own company. ->addAllowedPackage('vendor_name/foo_bar') // Allow a specific package regardless of licensing. ->build();
./vendor/bin/composer-license-checker [--allow-file path/to/configuration_file.php]
It is suggested you build this into your CI pipeline to automate checking it.
Licensing information providers
This tool can use two different sources for retrieving licensing information: using the composer licenses command and parsing the installed.json file created by Composer.
Using the installed.json provider (default)
Specify --provider-id=json.
The tool will parse the installed.json file created by Composer which has all the relevant information. This does not require Composer to be installed in the environment the tool is executed within. This file is internal to Composer however, so there is the potential that the schema may change in the future. If you experience issues, try using the composer licenses provider and report the issue.
Using composer licenses provider
Specify --provider-id=licenses.
The composer licenses command provides a (potentially) more stable API for retrieving licensing information. This however requires the tool to execute composer so it must be installed in the environment the tool is run within.
lendable/composer-license-checker 适用场景与选型建议
lendable/composer-license-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 266.09k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2023 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 lendable/composer-license-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 lendable/composer-license-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 266.09k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 15
- 点击次数: 16
- 依赖项目数: 16
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-18