adachsoft/packagist-api-client
最新稳定版本:1.0.0
Composer 安装命令:
composer require adachsoft/packagist-api-client
包简介
PHP client for Packagist API
README 文档
README
A simple PHP client for interacting with the Packagist API.
Installation
composer require adachsoft/packagist-api-client
Quick Start
<?php
use AdachSoft\PackagistApiClient\PackagistApiClient;
$client = new PackagistApiClient('your-username', 'your-api-token');
// Search packages
$results = $client->searchPackages('symfony');
// Get package info
$package = $client->getPackageData('symfony/symfony');
// Get package statistics
$stats = $client->getPackageStats('symfony/symfony');
Features
- Package Management: Create, edit, and update packages
- Search: Find packages by name, tags, or type
- Statistics: Get download statistics and general Packagist stats
- Security: Check security advisories for packages
- Popular Packages: List trending packages
Basic Usage
Initialize Client
$client = new PackagistApiClient($username, $apiToken);
Search Packages
// Simple search
$results = $client->searchPackages('monolog');
// Search with filters
$results = $client->searchPackages('logger', [
'tags' => 'psr-3',
'type' => 'library'
]);
Get Package Details
$package = $client->getPackageData('monolog/monolog');
echo $package['package']['description'];
Get Statistics
// Package stats
$stats = $client->getPackageStats('monolog/monolog');
echo "Total downloads: " . $stats['downloads']['total'];
// General stats
$stats = $client->getStatistics();
echo "Total packages: " . $stats['totals']['packages'];
Create Package (requires authentication)
$client->createPackage('https://github.com/username/repository');
Requirements
- PHP 8.3+
- Guzzle HTTP client
License
MIT
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-05