# Packagist Scraper: PHP Composer Packages (`arman-bd/packagist-scraper`) Actor

Scrape Packagist for PHP package data: versions, requires, autoload config, licences, authors, download counts and abandoned status. Essential for Composer dependency audits and SBOMs.

- **URL**: https://apify.com/arman-bd/packagist-scraper.md
- **Developed by:** [Arman Hossain](https://apify.com/arman-bd) (community)
- **Categories:** Developer tools, Automation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.56 / 1,000 package scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Packagist Scraper: PHP Composer Packages

![Packagist Scraper: Composer package metadata resolved in full, dependencies, autoload config, licences, authors and downloads](https://api.apify.com/v2/key-value-stores/ZQOcNAOHrIgTacAmy/records/packagist-scraper.jpg)

**Packagist Scraper** turns any list of `vendor/package` names into flat, structured records, latest version, full `require` and `require-dev` maps, autoload config, licences, authors, PHP requirement, abandonment status, security advisories and download counts.

It reads Packagist's Composer metadata directly, the same CDN-cached files `composer update` downloads. **No proxy setup, no browser, no credentials to manage.** A metadata lookup is a single request.

**Agent skill: [SKILL.md](https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/packagist-scraper.md)**

```
https://api.apify.com/v2/key-value-stores/t7YoTxpZEJOWvw4Ug/records/packagist-scraper.md
```

### What you get

| Output field | Meaning |
|---|---|
| `name`, `vendor`, `packageName` | Canonical identifier, split for easy grouping by vendor |
| `description`, `type`, `keywords`, `homepage` | Package summary, Composer type (`library`, `symfony-bundle`, …) and tags |
| `latestVersion`, `latestVersionNormalized`, `lastRelease` | Newest release and when it was tagged |
| `firstRelease`, `releaseCount`, `stableReleaseCount` | Project age and how many versions exist, stable and total |
| `license`, `authors`, `maintainers` | Declared SPDX licences, gemspec-style author blocks and Packagist account names |
| `phpRequirement`, `require`, `requireDev`, `suggest` | The PHP constraint on its own, plus the full dependency maps |
| `autoload` | PSR-4 / PSR-0 / classmap / files configuration |
| `abandoned`, `abandonedInFavourOf` | Whether the package is abandoned and what its author points to instead |
| `source`, `dist` | Git URL and commit reference, and the zipball URL Composer downloads |
| `support`, `funding`, `repository`, `language` | Issue tracker and docs links, funding channels, upstream repo |
| `securityAdvisories` | Advisory IDs and affected version ranges, shipped in the metadata file |
| `downloadsTotal`, `downloadsMonthly`, `downloadsDaily`, `favers`, `dependents`, `suggesters` | Install volume and ecosystem reach (opt-in) |
| `githubStars`, `githubForks`, `githubOpenIssues` | Upstream repository signals (opt-in) |
| `releases`, `devBranches` | Version history and open development branches (opt-in) |
| `scrapedAt` | Run timestamp |

A `RUN_SUMMARY` record in the key-value store holds per-run counts, the filters used, unknown and malformed names, and any lookup that failed.

### Common use cases

- **Abandonment audits.** `abandoned` plus `abandonedInFavourOf` and a stale `lastRelease` tell you exactly what to migrate off.
- **Composer SBOMs.** `require`, `requireDev`, `dist` and `source` give you the full pinned graph with commit references.
- **PHP-version migration planning.** `phpRequirement` per version shows when each dependency picked up PHP 8.4 support.
- **Ecosystem research.** Run with no input to pull the most-installed packages ranked by Packagist itself.

### Quick start

Three packages, default depth:

```json
{
 "packages": ["monolog/monolog", "guzzlehttp/guzzle", "symfony/console"]
}
```

An abandonment and dependency audit with history:

```json
{
 "packages": ["laravel/framework", "swiftmailer/swiftmailer", "phpunit/phpunit"],
 "includeVersionHistory": true,
 "maxVersions": 30,
 "includeDevBranches": true
}
```

Fastest possible sweep, metadata only, no rate-limited stats call:

```json
{
 "packages": ["symfony/console", "symfony/process"],
 "includeStats": false
}
```

### Input

| Field | Type | Default | Notes |
|---|---|---|---|
| `packages` | array | `[]` | `vendor/package` names, packagist.org URLs or `composer require` lines. Empty pulls the most-installed packages. |
| `onlyStable` | boolean | `true` | Ignore alpha/beta/RC/dev versions when picking the version each record describes. |
| `includeVersionHistory` | boolean | `false` | Add the `releases` array. Costs no extra request. |
| `maxVersions` | integer | `20` | Cap on entries in `releases`, newest first. |
| `includeDevBranches` | boolean | `false` | Add `devBranches` from the `~dev` metadata file. One extra request per package. |
| `includeStats` | boolean | `true` | Add downloads, favers, dependents and GitHub counts. One extra request per package. |
| `maxPackages` | integer | `25` | Cap on packages per run. |

Names are lowercased, deduped and stripped of constraints before any request. Anything without a slash is skipped and reported in `RUN_SUMMARY.malformedNames` rather than sent to the API.

### Output example

```json
{
 "name": "monolog/monolog",
 "vendor": "monolog",
 "packageName": "monolog",
 "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
 "type": "library",
 "keywords": ["log", "logging", "psr-3"],
 "homepage": "https://github.com/Seldaek/monolog",
 "repository": "https://github.com/Seldaek/monolog",
 "language": "PHP",
 "latestVersion": "3.10.0",
 "latestVersionNormalized": "3.10.0.0",
 "lastRelease": "2026-01-02T08:56:05+00:00",
 "firstRelease": "2011-07-07T16:21:02+00:00",
 "releaseCount": 87,
 "stableReleaseCount": 83,
 "license": ["MIT"],
 "authors": [{ "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", "homepage": "https://seld.be", "role": null }],
 "maintainers": ["Seldaek"],
 "phpRequirement": ">=8.1",
 "require": { "php": ">=8.1", "psr/log": "^2.0 || ^3.0" },
 "requireDev": { "phpunit/phpunit": "^10.5.17 || ^11.0.7" },
 "suggest": { "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server" },
 "autoload": { "psr-4": { "Monolog\\": "src/Monolog" } },
 "abandoned": false,
 "abandonedInFavourOf": null,
 "source": { "url": "https://github.com/Seldaek/monolog.git", "type": "git", "reference": "b321dd67…" },
 "dist": { "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd67…", "type": "zip", "shasum": "" },
 "support": { "issues": "https://github.com/Seldaek/monolog/issues" },
 "funding": [{ "url": "https://github.com/Seldaek", "type": "github" }],
 "securityAdvisories": [{ "advisoryId": "PKSA-dmw8-jd8k-q3c6", "affectedVersions": ">=1.8.0,<1.12.0" }],
 "downloadsTotal": 1036088143,
 "downloadsMonthly": 18121188,
 "downloadsDaily": 772059,
 "favers": 22261,
 "dependents": 8416,
 "suggesters": 633,
 "githubStars": 21396,
 "githubForks": 1907,
 "githubOpenIssues": 32,
 "scrapedAt": "2026-08-06T11:52:18.911Z"
}
```

### API example

```bash
curl -X POST "https://api.apify.com/v2/acts/arman-bd~packagist-scraper/run-sync-get-dataset-items?token=YOUR_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{
 "packages": ["monolog/monolog", "laravel/framework"],
 "includeVersionHistory": true,
 "maxVersions": 10
 }'
```

### Limits and behaviour

- **The metadata is minified, and this Actor expands it.** Packagist serves `composer/2.0` format: only the first version object is complete, every later one lists just the keys that changed, and the literal string `"__unset"` removes a key. Read naively, version 3.6.0 of Monolog looks like it has no licence, no authors and no dependencies. The Actor replays the diffs forward exactly as Composer does, so every entry in `releases` is fully resolved.
- **Versions arrive newest first.** Index 0 of the metadata array is the latest tag, not the oldest, and filtering never reorders it.
- **Two hosts, two budgets.** Package metadata comes from `repo.packagist.org`, which is CDN-cached and cheap. Download counts, favers and GitHub stats only exist on `packagist.org`, which is rate limited. That is why `includeStats` is a separate switch, and why requests are spaced 400 ms apart across both.
- **Stats failing does not lose the package.** If the stats call errors, the record is still written with the metadata fields populated and the stats fields `null`; the miss is noted in `RUN_SUMMARY.failures`.
- **`releaseCount` counts tagged versions only.** Dev branches are not tags and live in a separate metadata file, reachable via `includeDevBranches`.
- **A missing package is a per-item failure.** The CDN answers 404 with an HTML body rather than JSON; that name lands in `RUN_SUMMARY.unknownPackages` and the run carries on. The Actor errors out only when *every* lookup failed.
- **Transient errors are retried.** 429 and 5xx get three attempts with backoff, honouring `Retry-After` when Packagist sends one.

**Defaults:** 1 GB memory, 15 minute timeout.

### FAQ

**Do I need a Packagist account or API key?** No. You supply no credentials.

**Does it need a proxy?** No. There is nothing for a proxy to solve.

**Why is `firstRelease` earlier than the date on the Packagist page?** Packagist shows when the package was submitted to the index; `firstRelease` is the tag date of its oldest published version, which is usually earlier.

**What counts as unstable?** Composer's own rule: a `version_normalized` carrying `-dev`, `-alpha`, `-beta`, `-rc` or `-patch`, or a version starting `dev-`. With `onlyStable` on, those are excluded from `latestVersion`, `releases` and `firstRelease`, but still counted in `releaseCount`.

**Are the security advisories complete?** They are the advisory IDs and affected ranges Packagist ships alongside the metadata. For full descriptions, severities and CVE aliases, feed the same package list into the OSV Scraper with ecosystem `Packagist`.

**Can I get a private or self-hosted package?** No. This reads the public Packagist index only; Private Packagist requires authentication and is out of scope.

**Can I integrate it with something else?** Yes, Apify API, client libraries, webhooks, scheduled runs, dataset exports (JSON/CSV/Excel) or MCP. Output is structured JSON.

# Actor input Schema

## `packages` (type: `array`):

Composer package identifiers in vendor/package form (packagist.org/packages/monolog/monolog → 'monolog/monolog'). Full URLs and 'composer require' lines with a constraint ('monolog/monolog:^3.0') are accepted and reduced to the name. Entries without a slash are skipped and listed in RUN\_SUMMARY.malformedNames. Leave empty to pull the most-installed packages instead.

## `onlyStable` (type: `boolean`):

Ignore alpha, beta, RC, patch and dev versions when choosing the version each record describes. On by default so 'latestVersion' means what Composer would actually install. Turn it off to let a prerelease be the latest; 'releaseCount' always counts every tagged version either way.

## `includeVersionHistory` (type: `boolean`):

Add a 'releases' array with each version's number, release date, prerelease flag, PHP requirement and source commit, newest first. It comes from the metadata already downloaded, so it costs no extra request.

## `maxVersions` (type: `integer`):

How many versions the 'releases' array keeps, counting back from the newest. Ignored when Include version history is off. Symfony components have hundreds of tags, so leaving this low keeps the dataset readable.

## `includeDevBranches` (type: `boolean`):

Add a 'devBranches' array from Packagist's separate ~dev metadata file: dev-main, 2.x-dev and any open feature branch, with the same shape as 'releases'. A good activity signal, at the cost of one extra request per package.

## `includeStats` (type: `boolean`):

Add total, monthly and daily downloads, favers, dependent and suggester counts, GitHub stars, forks and open issues, plus the maintainer list. These live on packagist.org rather than the CDN metadata host, so this costs one extra rate-limited request per package. Turn it off for the fastest possible run.

## `maxPackages` (type: `integer`):

Cap on how many packages are looked up in one run. Each package is one request, plus one more for stats and one more for dev branches. Applies to both an explicit list and the popularity-ranking fallback.

## Actor input object example

```json
{
  "packages": [
    "laravel/framework",
    "phpunit/phpunit"
  ],
  "onlyStable": true,
  "includeVersionHistory": false,
  "maxVersions": 20,
  "includeDevBranches": false,
  "includeStats": true,
  "maxPackages": 25
}
```

# Actor output Schema

## `items` (type: `string`):

Every record the run produced.

## `runsummary` (type: `string`):

The RUN\_SUMMARY record from the run's key-value store.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "packages": [
        "monolog/monolog",
        "guzzlehttp/guzzle",
        "symfony/console"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("arman-bd/packagist-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "packages": [
        "monolog/monolog",
        "guzzlehttp/guzzle",
        "symfony/console",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("arman-bd/packagist-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "packages": [
    "monolog/monolog",
    "guzzlehttp/guzzle",
    "symfony/console"
  ]
}' |
apify call arman-bd/packagist-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,arman-bd/packagist-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/wN0eGUCn8PcfgKlft/builds/ayMBabdzrEE1YB3yA/openapi.json
