comcast/php-legal-licenses

一个用于生成包含项目每个依赖项完整授权文本的授权文件的实用工具,用于法律目的。

v1.3.0 2024-05-07 14:53 UTC

README

StyleCI Status Total Downloads Latest Stable Version License

PHP Legal Licenses

法律授权是一个实用工具,用于帮助生成一个包含项目依赖项所有重要信息的单一文本文件。在一些组织中,开源软件(OSS)的使用受到严格的控制和审计,并要求对每个 OSS 库进行简单的文档记录。

此实用工具将在项目的根目录中生成一个 licenses.md 文件,其中包含所有依赖项的列表、当前安装的版本、commit sha、其描述、主页、授权列表以及如果存在于依赖项源代码中,则包含完整的授权文本。它从 composer.lock 文件中获取此信息,因此您至少需要运行一次 composer updatecomposer install 才能使用此实用工具。

安装

如果您需要此类实用工具用于您的企业,那么您很可能需要将其用于多个项目。因此,安装此实用工具的最简单和推荐的方法是将它作为全局 composer 包。

composer global require comcast/php-legal-licenses

使用方法

如果您通过 composer 全局安装了 php-legal-licenses,则应该能够在您的任何项目中运行脚本。请注意,您必须至少运行过一次 composer updatecomposer install,以创建 composer.lock 文件。

$ cd /path/to/my/project
$ which php-legal-licenses
> ~/.composer/vendor/bin/php-legal-licenses
$ php-legal-licenses generate
> Generating Licenses file...
> Done!

您还可以使用 --hide-version 选项隐藏依赖项版本。

$ php-legal-licenses generate --hide-version

您可以使用 --csv 选项输出 csv 文件。

$ php-legal-licenses generate --csv

或同时使用这两个选项。

$ php-legal-licenses generate --hide-version --csv

示例输出

以下是将为此实用工具本身生成的授权文件的片段。

# Project Licenses
This file was generated by the Legal Licenses utility. It contains the name, version and commit sha, description, homepage, and license information for every dependency in this project.

## Dependencies

### psr/log (Version 1.0.2 | 4ebe3a8)
Common interface for logging libraries
Homepage: https://github.com/php-fig/log
Licenses Used: MIT
Copyright (c) 2012 PHP Framework Interoperability Group

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


### symfony/console (Version v3.3.6 | b087823)
Symfony Console Component
Homepage: https://symfony.com.cn
Licenses Used: MIT

...