PHPackages                             spatie/packagist-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. spatie/packagist-api

ActiveLibrary[API Development](/categories/api)

spatie/packagist-api
====================

Fetch package info from Packagist

2.1.1(1y ago)1301.8M—8%2111MITPHPPHP ^8.2CI failing

Since May 6Pushed 8mo ago6 watchersCompare

[ Source](https://github.com/spatie/packagist-api)[ Packagist](https://packagist.org/packages/spatie/packagist-api)[ Docs](https://github.com/spatie/packagist-api)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/spatie-packagist-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (5)Versions (16)Used By (11)

Fetch package info from Packagist
=================================

[](#fetch-package-info-from-packagist)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7a5a0ae5caf7bdf1772f431dee3f130da8b4e699717271c516bedeb42349d640/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f7061636b61676973742d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/packagist-api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![GitHub Workflow Status](https://camo.githubusercontent.com/77209f7779defd8ad023095a2b76326dad5ad25bfa670a3e5187e6c2ad6e6bb9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f7061636b61676973742d6170692f72756e2d74657374733f6c6162656c3d7465737473)](https://camo.githubusercontent.com/77209f7779defd8ad023095a2b76326dad5ad25bfa670a3e5187e6c2ad6e6bb9/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f7061636b61676973742d6170692f72756e2d74657374733f6c6162656c3d7465737473)[![Total Downloads](https://camo.githubusercontent.com/15b6889354920b2fcd92797aed1f7d80e4eee2fd09fb9408792764168f221b88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f7061636b61676973742d6170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/packagist-api)

This package makes it easy to search and fetch package info using [the Packagist API](https://packagist.org/apidoc).

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/9cc50eee1ec80f6fda20e8303e4dccc845064c1a177190e02708bd080fd79e55/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f7061636b61676973742d6170692e6a70673f743d31)](https://spatie.be/github-ad-click/packagist-api)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require spatie/packagist-api
```

There is also a [Laravel wrapper](https://packagist.org/packages/markwalet/laravel-packagist) available for this package.

Usage
-----

[](#usage)

You must pass a Guzzle client and a url generator to the constructor of `Spatie\Packagist\PackagistClient`.

```
$client = new \GuzzleHttp\Client();
$generator = new \Spatie\Packagist\PackagistUrlGenerator();

$packagist = new \Spatie\Packagist\PackagistClient($client, $generator);
```

### List package names

[](#list-package-names)

```
// All packages
$packagist->getPackagesNames();

// List packages by type.
$packagist->getPackagesNamesByType('composer-plugin');

// List packages by organization
$packagist->getPackagesNamesByVendor('spatie');
```

### List popular packages

[](#list-popular-packages)

```
// List first page of popular packages
$packagist->getPopularPackages();
```

#### Pagination

[](#pagination)

Listing popular packages returns a paginated result. You can change the pagination settings by adding more parameters.

```
// Get the third page, 10 items per page.
$packagist->getPopularPackages(3, 10);
```

### Searching for packages

[](#searching-for-packages)

```
// Search packages by name.
$packagist->searchPackagesByName('packagist');

// Search packages by tag.
$packagist->searchPackagesByTags('psr-3');

// Search packages by type.
$packagist->searchPackagesByType('composer-plugin');

// Combined search.
$packagist->searchPackages('packagist', ['type' => 'library']);
```

#### Pagination

[](#pagination-1)

Searching for packages returns a paginated result. You can change the pagination settings by adding more parameters.

```
// Get the third page, 10 items per page.
$packagist->searchPackagesByName('packagist', 3, 10);
```

### Getting package data.

[](#getting-package-data)

```
// Using the Composer metadata. (faster, but less data)
$packagist->getPackageMetadata('spatie/packagist-api');
$packagist->getPackageMetadata('spatie', 'packagist-api');

// Using the Composer metadata for dev branches.
$packagist->getPackageMetadata('spatie', 'packagist-api', true);

// Using the API. (slower, cached for 12 hours by Packagist.
$packagist->getPackage('spatie/packagist-api');
$packagist->getPackage('spatie', 'packagist-api');
```

### Get package download stats

[](#get-package-download-stats)

```
$packagist->getPackageDownloadStats('spatie/packagist-api');
$packagist->getPackageDownloadStats('spatie', 'packagist-api');
```

### Get Statistics

[](#get-statistics)

```
$packagist->getStatistics();
```

### Get security vulnerability advisories

[](#get-security-vulnerability-advisories)

```
// Get advisories for specific packages
$packages = ['spatie/packagist-api'];
$advisories = $packagist->getAdvisories($packages);

// Get advisories for specific packages that were updated after some timestamp
$packages = ['spatie/packagist-api'];
$advisories = $packagist->getAdvisories($packages, strtotime('2 weeks ago'));

// Get advisories only for specific versions of specific packages
$packages = ['spatie/packagist-api' => '2.0.2'];
$advisories = $packagist->getAdvisoriesAffectingVersions($packages);
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [Jolita Grazyte](https://github.com/JolitaGrazyte)
- [Mark Walet](https://github.com/markwalet)
- [All Contributors](../../contributors)

About Spatie
------------

[](#about-spatie)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

61

—

FairBetter than 99% of packages

Maintenance54

Moderate activity, may be stable

Popularity58

Moderate usage in the ecosystem

Community33

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 51.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~231 days

Recently: every ~413 days

Total

15

Last Release

424d ago

Major Versions

0.0.1 → 1.0.02016-05-14

1.3.1 → v2.x-dev2020-04-08

v1.x-dev → 2.1.12025-03-21

PHP version history (6 changes)0.0.1PHP ^5.5|^7.0

1.3.0PHP ^7.3

1.3.1PHP ^7.2

2.0.2PHP ^7.2|^8.0

2.1.0PHP ^7.3|^8.0

2.1.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (96 commits)")[![markwalet](https://avatars.githubusercontent.com/u/11446771?v=4)](https://github.com/markwalet "markwalet (28 commits)")[![mbabker](https://avatars.githubusercontent.com/u/368545?v=4)](https://github.com/mbabker "mbabker (10 commits)")[![chrisdicarlo](https://avatars.githubusercontent.com/u/3483368?v=4)](https://github.com/chrisdicarlo "chrisdicarlo (10 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (9 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (8 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (7 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (3 commits)")[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (3 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![GuySartorelli](https://avatars.githubusercontent.com/u/36352093?v=4)](https://github.com/GuySartorelli "GuySartorelli (2 commits)")[![akiyamaSM](https://avatars.githubusercontent.com/u/12276076?v=4)](https://github.com/akiyamaSM "akiyamaSM (2 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (2 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![AegirLeet](https://avatars.githubusercontent.com/u/33277331?v=4)](https://github.com/AegirLeet "AegirLeet (1 commits)")[![swapnilsarwe](https://avatars.githubusercontent.com/u/166912?v=4)](https://github.com/swapnilsarwe "swapnilsarwe (1 commits)")[![mpociot](https://avatars.githubusercontent.com/u/804684?v=4)](https://github.com/mpociot "mpociot (1 commits)")

---

Tags

apipackagistphpspatieapipackagist

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/spatie-packagist-api/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-packagist-api/health.svg)](https://phpackages.com/packages/spatie-packagist-api)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[spatie/laravel-fractal

An easy to use Fractal integration for Laravel applications

1.9k15.1M99](/packages/spatie-laravel-fractal)[spatie/dropbox-api

A minimal implementation of Dropbox API v2

3116.0M36](/packages/spatie-dropbox-api)[knplabs/packagist-api

Packagist API client.

1821.3M34](/packages/knplabs-packagist-api)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
