rayrutjes/packagist-api-client
Composer 安装命令:
composer require rayrutjes/packagist-api-client
包简介
Simple Packagist API Client in PHP
README 文档
README
Let's consume the Packagist API.
Installation
This library can be found on Packagist. The recommended way to install this is through composer.
Run these commands to install composer, the library and its dependencies:
$ curl -sS https://getcomposer.org/installer | php
$ php composer.phar require rayrutjes/packagist-api-client
You then need to install one of the following:
$ php composer.phar require guzzlehttp/guzzle:~5.0 $ php composer.phar require guzzlehttp/guzzle:~6.0
Usage
Initialize client
<?php require 'vendor/autoload.php'; use PackagistApi\Client; use PackagistApi\Adapter\GuzzleHttpAdapter; // Create an adapter. $adapter = new GuzzleHttpAdapter(); // Create a Client object with the previous adapter. $packagist = new Client($adapter); // ...
Retrieve all package names available
Accepts the following optional parameters:
- vendor
- type
<?php // ... initialize Client like explained above. $packageNames = $packagist->getAllPackageNames([ 'vendor' => 'composer', // Optional. 'type' => 'composer-plugin', // Optional. ]); var_dump($packageNames);
Get a package with all its download statistics
Will throw an PackagistApi\Exception\HttpException if the package does not exist.
<?php // ... initialize Client like explained above. $package = $packagist->getPackageByName('rayrutjes/packagist-api-client'); var_dump($package);
Search for packages
Accepts the following optional parameters:
- q
- tags
- type
- per_page
- page
<?php // ... initialize Client like explained above. $packages = $packagist->searchPackages([ 'q' => 'monolog', // Optionally filter by name. 'tags' => 'psr-3', // Optionally filter by tag. 'type' => 'symfony-bundle', // Optionally filter by type. 'per_page' => 10, // Optionally change the number of results per page. 'page' => 3, // Optionally choose the results page. ]); var_dump($packages); // Iterate over all search results. $packages = []; $page = 1; $limit = 500; do { $result = $packagist->searchPackages([ 'q' => 'monolog', // Optionally filter by name. 'per_page' => 100, // Optionally change the number of results per page. 'page' => $page, // Optionally choose the results page. ]); $packages = array_merge($packages, $result['results']); ++$page; } while (isset($result['next']) && count($packages) <= $limit); var_dump($packages);
Get popular packages
Accepts the following optional parameters:
- per_page
- page
<?php // ... initialize Client like explained above. $popularPackages = $packagist->getPopularPackages([ 'per_page' => 10, // Optionally change the number of results per page. 'page' => 3, // Optionally choose the results page. ]); var_dump($popularPackages); // Iterate over all popular packages. $packages = []; $page = 1; $limit = 500; do { $result = $packagist->getPopularPackages([ 'per_page' => 100, // Optionally change the number of results per page. 'page' => $page, // Optionally choose the results page. ]); $packages = array_merge($packages, $result['packages']); ++$page; } while (isset($result['next']) && count($packages) <= $limit); var_dump($packages);
Contributing
Please see CONTRIBUTING for details.
Changelog
Please see CHANGELOG for details.
Support
Please open an issue in github
Contributor Code of Conduct
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
This Code of Conduct is adapted from the Contributor Covenant, version 1.0.0, available at http://contributor-covenant.org/version/1/0/0/.
License
PackagistApi is released under the MIT License. See the bundled LICENSE file for details.
rayrutjes/packagist-api-client 适用场景与选型建议
rayrutjes/packagist-api-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 01 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rayrutjes/packagist-api-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rayrutjes/packagist-api-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-01-09