APIs / Apps and media / Packagist

1 credit per call3 endpoints7 datapointsChecked working 6 Dec 2026

Packagist API

Packagist API for PHP package search, popular packages and package details with downloads, GitHub stars and dependents. 1 credit per successful call.

Packagist
GET/v1/packagist/search?query=laravel&per_page=10
{
  "success": true,
  "data": {
    "total": 100277,
    "page": 1,
    "has_more": true,
    "count": 10,
    "items": [
      {
        "name": "laravel/framework",
        "description": "The Laravel Framework.",
        "downloads": 639185601,
        "favers": 35779,
        "repository": "https://github.com/laravel/framework",
        "abandoned": false,
        "url": "https://packagist.org/packages/laravel/framework"
      },
      {
        "name": "spatie/laravel-permission",
        "description": "Permission handling for Laravel 12 and up",
        "downloads": 140288066,
        "favers": 13165,
        "repository": "https://github.com/spatie/laravel-permission",
        "abandoned": false,
        "url": "https://packagist.org/packages/spatie/laravel-permission"
      },
      {
        "name": "spatie/laravel-activitylog",
        "description": "A very simple activity logger to monitor the users of your website or application",
        "downloads": 75371457,
        "favers": 5995,
        "repository": "https://github.com/spatie/laravel-activitylog",
        "abandoned": false,
        "url": "https://packagist.org/packages/spatie/laravel-activitylog"
      }
    ]
  },
  "meta": {
    "request_id": "req_b00d327c410a4217a909e6939dd2c221",
    "credits_charged": 1,
    "credits_remaining": 1995
  }
}
200 OKJSONX-Credits-Used: 1
Recorded from our API and shortened.

Sample data

What one call returns

A recorded run of search: the fields and shapes you will get, shortened to 3 items.

#namestringdescriptionstringdownloadsintegerfaversintegerrepositoryurlabandonedbooleanurlurl
1laravel/frameworkThe Laravel Framework.63918560135779https://github.com/laravel/frameworkfalsehttps://packagist.org/packages/laravel/framework
2spatie/laravel-permissionPermission handling for Laravel 12 and up14028806613165https://github.com/spatie/laravel-permissionfalsehttps://packagist.org/packages/spatie/laravel-permission
3spatie/laravel-activitylogA very simple activity logger to monitor the users of your website or application753714575995https://github.com/spatie/laravel-activitylogfalsehttps://packagist.org/packages/spatie/laravel-activitylog

Recorded from our API · 3 items shown · 7 datapoints per itemGET /v1/packagist/search?query=laravel&per_page=10

7 datapoints

Identity

  • namestring

Contact

  • urlurl

Other

  • descriptionstring
  • downloadsinteger
  • faversinteger
  • repositoryurl
  • abandonedboolean

Playground

Run this API

cURLshell
curl "https://api.perceptlayer.com/v1/packagist/search?query=laravel&per_page=10" \
  -H "X-API-Key: $API_KEY"

Packagist · 3 endpoints

Endpoints

Every endpoint takes the same key. Open one for its parameters, the fields it returns and an example request.

EndpointRequired parametersReturnsCost
GET/v1/packagist/package
name
namedescriptiondownloadsfaversrepositoryabandoned+11 more
1 credit
GET/v1/packagist/popular
none+2 optional
namedescriptiondownloadsfaversabandonedurl
1 credit
GET/v1/packagist/search
query+3 optional
namedescriptiondownloadsfaversrepositoryabandoned+1 more
1 credit

Overview

About the Packagist API

What you can get

The Packagist API returns PHP package data from Packagist as JSON through 3 endpoints. Packages are named vendor/package.

  • Search: search takes a query, with type (for example library, symfony-bundle or wordpress-plugin), page and per_page (1 to 100).
  • Popular: popular lists the most popular packages, with page and per_page.
  • Packages: package takes a name, for example laravel/framework.

The recorded search for "laravel" returns items, each with name, description, downloads, favers, repository, abandoned and url, plus total (100,277 in that recording), page and has_more. The first result, laravel/framework, had 639,185,601 downloads and 35,779 favers.

package returns downloads split into total, monthly and daily, github (stars, watchers, forks and open_issues), dependents, suggesters, maintainers, type, language, created_at, version_count, latest_version (with its license, php constraint and requires) and recent versions. In the recording, laravel/framework had 29,617,807 monthly downloads and 21,767 dependents.

How a call works

Search, then look up: GET /v1/packagist/search?query=laravel&per_page=10 with your key in the X-API-Key header returns each package's name; package takes that name, for example GET /v1/packagist/package?name=laravel/framework. Check has_more before asking for the next page. Answers come from a cache for up to an hour, so download counts can be up to an hour old. Every successful call costs 1 credit; failed calls cost nothing.

Apps and mediaJSONRESTMCP

More apps and media APIs

Use cases

Vet a Composer dependency: monthly downloads, dependents, open issues and whether it is `abandoned`

Use the Packagist API to vet a Composer dependency: monthly downloads, dependents, open issues and whether it is `abandoned`

Check a package's PHP version constraint and requirements before upgrading

Use the Packagist API to check a package's PHP version constraint and requirements before upgrading

Compare PHP libraries for a job by downloads and favers

Use the Packagist API to compare PHP libraries for a job by downloads and favers

Find WordPress plugins or Symfony bundles on Packagist with `type`

Use the Packagist API to find WordPress plugins or Symfony bundles on Packagist with `type`

FAQ

Questions

How much does the Packagist API cost?

Each successful call costs one credit, and each page of results is one call. New accounts get free credits to start, and credit packs bring the price down as you scale.

Is `latest_version` the newest major version?

Yes: it is the highest stable version number, so a patch to an older branch never replaces it. `versions` lists stable releases newest first, so it can start with such a patch. Read `version_count` for the full history.

How is `popular` ordered?

In the order Packagist ranks them, which is not strictly by total downloads. In the recording, `symfony/deprecation-contracts` came first with 1,037,084,657 downloads, ahead of packages with more. It reports a `total` of 484,763 packages.

Do I need a Packagist account?

No. You call this Packagist API with your Perceptlayer key in the `X-API-Key` header, with no Packagist login or GitHub token.

Is this the official Packagist API?

No. Perceptlayer is an independent service and is not affiliated with Packagist. It returns Packagist data as JSON with a Perceptlayer key, so there is no Packagist developer account, app review or partner approval to get first. It only reads data: if Packagist has an official API and you need to act on your own Packagist account, such as posting, managing orders or reading private data, use that one.

Should I build a Packagist scraper instead?

You can, but a Packagist scraper is code you maintain: page changes break it, requests get blocked, and Packagist's terms govern how you collect data. The Packagist API gives you 3 endpoints of named JSON fields for 1 credit per successful call, and failed calls cost nothing. A scraper makes sense only for data these endpoints don't return, so check the response in the playground on this page first.

Try the Packagist API with 100 free credits

No credit card. Failed calls are never billed.