التراخيص القانونية هي أداة مساعدة تساعد في إنشاء ملف نصي واحد يحتوي على كافة المعلومات المهمة حول تبعيات المشروع. في بعض المؤسسات، يخضع استخدام البرامج مفتوحة المصدر (OSS) لرقابة وتدقيق صارمين، ويتطلب توثيق كل مكتبة OSS ببساطة.
ستقوم هذه الأداة المساعدة بإنشاء ملف licenses.md
في جذر مشروعك الذي يحتوي على قائمة بجميع التبعيات، والإصدار المثبت حاليًا، والالتزام Sha، ووصفه، والصفحة الرئيسية، وقائمة التراخيص، ونص الترخيص الكامل إذا كان موجودًا في كود مصدر التبعية مباشرة. فهو يتلقى هذه المعلومات من ملف composer.lock
، لذلك يجب عليك تشغيل composer update
أو composer install
مرة واحدة على الأقل حتى تتمكن من استخدام هذه الأداة المساعدة.
إذا كنت بحاجة إلى أداة مثل هذه لمكان عملك، فمن المحتمل أنك ستحتاج إليها لأكثر من مشروع واحد. ولذلك، فإن الطريقة الأسهل والموصى بها لتثبيت هذه الأداة هي حزمة الملحن العامة:
composer global require comcast/php-legal-licenses
إذا قمت بتثبيت تراخيص php-legal-عموميًا عبر Composer، فمن المفترض أن تكون قادرًا على تشغيل البرنامج النصي في أي من مشاريعك. لاحظ أنه يجب عليك تشغيل composer update
أو composer 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
Licenses Used: MIT
...