fundevogel/php-thx
最新稳定版本:2.0.0
Composer 安装命令:
composer require fundevogel/php-thx
包简介
Acknowledge the people behind your dependencies - give back & spread love!
README 文档
README
A very simple PHP library for acknowledging the people behind your dependencies - and giving thanks.
Getting started
Install this package with Composer:
composer require fundevogel/php-thx
Usage
Spreading love & giving back should be easy, like this:
use Fundevogel\Thx\ThankYou; # Define paths to necessary files $dataFile = 'path/to/composer.json'; # .. 'package.json' $lockFile = 'path/to/composer.lock' # .. 'package-lock.json' or 'yarn.lock' try { # Extract & extend dataset $data = ThankYou::veryMuch($dataFile, $lockFile); } catch (Exception $e) { # No dependencies found, file not found, .. echo $e->getMessage(); }
.. and in case you want to have more control, instantiate the appropriate Driver & configure it as needed:
use Fundevogel\Thx\ThankYou; $driver = ThankYou::haveFun($dataFile, $lockFile); # Configuration for API calls $driver->timeout = 3600 # request timeout (in seconds) $driver->userAgent = 'YoursSincerely' # request UA string
By themselves, the files you already have don't yield much information (mostly package name & installed version), yet this is all we need to know to .. make some API calls (which is done automatically):
- Composer packages @ https://repo.packagist.org
- Node packages @ https://api.npms.io
Note: As always when requesting data from third-parties, make sure to implement some kind of caching so you don't get blocked or exceed whatever limit they impose, and remember: going easy on somebody else's ressources (especially when they're provided for free) shows that you care, and that's always worth striving for.
Roadmap
- Add support for
pnpm - Check out v3 npm
lockfileVersion
Credits
Most of the helper functions were taken from Kirby's excellent toolkit package by Bastian Allgeier (who's just awesome, btw).
Happy coding!
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2022-08-17