juststeveking/packagist-sdk

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

A simple SDK for packagist

v1.1.0 2020-10-30 12:19 UTC

This package is auto-updated.

Last update: 2021-05-29 01:36:21 UTC


README

Latest Version PHP Version tests Check & fix styling Total Downloads

A dead simple API package for the Packagist API.

Requirements

  • PHP ^7.4

Installation

$ composer require juststeveking/packagist-api

Using

Searching

Thanks to the fluent builder, we can build out search exactly as we need

use JustSteveKing\Packagist\SDK\Packagist;

$packagist = Packagist::connect();
$results = $packagist->search->where('q', 'JustSteveKing')
                ->where('type', 'library')
                ->fetch();

Get packages by vendor

use JustSteveKing\Packagist\SDK\Packagist;

$packagist = Packagist::connect();

$results = $packagist->packages->vendor('JustSteveKing');

Get meta information about a package

use JustSteveKing\Packagist\SDK\Packagist;

$packagist = Packagist::connect();

$result = $packagist->packages->meta('juststeveking', 'php-sdk');

Get Security Advisories about a package

use JustSteveKing\Packagist\SDK\Packagist;

$packagist = Packagist::connect();

$advisories = $packagist->advisories->package('slim', 'slim');

Fetch Packagist statistics

use JustSteveKing\Packagist\SDK\Packagist;

$packagist = Packagist::connect();

$stats = $packagist->statistics->fetch();