# Packagist Scraper (`crawlerbros/packagist-scraper`) Actor

Scrape Packagist.org, the main PHP package repository with 400K+ packages. Search by keyword, fetch specific packages, browse popular packages, and get repository statistics.

- **URL**: https://apify.com/crawlerbros/packagist-scraper.md
- **Developed by:** [Crawler Bros](https://apify.com/crawlerbros) (community)
- **Categories:** Developer tools, Automation, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 4 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $3.00 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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 a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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

Scrape **Packagist.org** — the main PHP package repository with 400K+ packages. Extract package metadata including download statistics, GitHub stats, maintainers, version history, and more — all without authentication or API keys.

### What does Packagist Scraper do?

Packagist Scraper lets you:
- **Search** for packages by keyword with optional type and tag filters
- **Look up** any specific package by `vendor/package` name
- **Browse** the most popular packages on Packagist
- **Retrieve** aggregate statistics for the entire Packagist ecosystem

All data is sourced from the official [Packagist API](https://packagist.org/apidoc), which is free, public, and rate-limit friendly.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `mode` | Select | ✅ | Operation mode: `search`, `byVendorPackage`, `popular`, or `statistics` |
| `query` | Text | mode=search | Search keyword (e.g. `symfony`, `laravel`, `guzzle`) |
| `vendorPackage` | Text | mode=byVendorPackage | Package in `vendor/package` format (e.g. `symfony/console`) |
| `packageType` | Select | No | Filter by type: `library`, `project`, `metapackage`, `composer-plugin`, `symfony-bundle` |
| `tags` | Array | No | Filter by tags (e.g. `["psr-7", "http"]`) |
| `maxItems` | Integer | No | Max packages to return (1–1000, default: `50`) |

#### Example inputs

**Search for Symfony packages:**
```json
{
  "mode": "search",
  "query": "symfony",
  "maxItems": 20
}
````

**Look up a specific package:**

```json
{
  "mode": "byVendorPackage",
  "vendorPackage": "symfony/console"
}
```

**Browse popular packages:**

```json
{
  "mode": "popular",
  "maxItems": 30
}
```

**Get Packagist statistics:**

```json
{
  "mode": "statistics"
}
```

### Output

Each record in the dataset contains:

| Field | Type | Description |
|-------|------|-------------|
| `name` | String | Package name in `vendor/package` format |
| `description` | String | Package description |
| `url` | String | URL on Packagist.org |
| `repository` | String | Source code repository URL |
| `downloads` | Integer | Total all-time downloads |
| `monthlyDownloads` | Integer | Downloads in the last 30 days |
| `dailyDownloads` | Integer | Downloads in the last day |
| `favers` | Integer | Number of users who starred/favorited the package |
| `maintainers` | Array | List of maintainer usernames |
| `type` | String | Package type (e.g. `library`, `symfony-bundle`) |
| `language` | String | Primary programming language |
| `githubStars` | Integer | GitHub stars |
| `githubForks` | Integer | GitHub forks |
| `githubWatchers` | Integer | GitHub watchers |
| `githubOpenIssues` | Integer | Open GitHub issues |
| `dependents` | Integer | Number of packages that depend on this one |
| `suggesters` | Integer | Number of packages that suggest this one |
| `abandoned` | Boolean | Whether the package is abandoned |
| `packageUrl` | String | Direct URL on Packagist.org |
| `scrapedAt` | String | Timestamp when the record was scraped |

#### Example output record

```json
{
  "name": "symfony/console",
  "description": "Eases the creation of beautiful and testable command line interfaces",
  "url": "https://packagist.org/packages/symfony/console",
  "repository": "https://github.com/symfony/console",
  "downloads": 500000000,
  "monthlyDownloads": 10000000,
  "dailyDownloads": 300000,
  "favers": 8000,
  "maintainers": ["fabpot", "nicolas-grekas"],
  "type": "library",
  "language": "PHP",
  "githubStars": 15000,
  "githubForks": 3000,
  "dependents": 10000,
  "abandoned": false,
  "packageUrl": "https://packagist.org/packages/symfony/console",
  "scrapedAt": "2026-05-25T12:00:00+00:00"
}
```

### Modes

#### `search` — Search packages by keyword

Search Packagist for packages matching a keyword. Supports filtering by package type and tags. Returns enriched data with GitHub stats and download breakdowns.

#### `byVendorPackage` — Get a specific package

Fetch full metadata for a single package by its `vendor/package` name. Includes all GitHub stats, download breakdown, maintainer list, and more.

#### `popular` — Browse popular packages

Retrieve the most downloaded/popular packages on Packagist with full detail enrichment.

#### `statistics` — Repository statistics

Get aggregate statistics for the entire Packagist repository (total packages, downloads, versions).

### FAQ

**Do I need an API key?**
No. Packagist's API is completely public and requires no authentication.

**How many packages can I scrape?**
Up to 1,000 per run with the `maxItems` parameter.

**Why is the scraper slower than expected?**
Packagist's search returns basic data, and the scraper enriches each result with full package details (GitHub stars, download breakdown, etc.) — this requires an additional API call per package. A rate-limit delay of 0.3s between calls ensures respectful scraping.

**What package types are available?**

- `library` — Reusable PHP library (most common)
- `project` — Full application skeleton
- `metapackage` — Package with no code, only dependencies
- `composer-plugin` — Extends Composer itself
- `symfony-bundle` — Symfony framework bundle

**Can I filter by tags?**
Yes. Use the `tags` array input to filter by one or more Packagist tags.

**What does `abandoned` mean?**
An abandoned package is one the author no longer maintains. Packagist may suggest a replacement package. The `abandoned` field is `true` if the package is abandoned.

**Is proxy required?**
No. Packagist's public API has no geo-restrictions and requires no proxy.

# Actor input Schema

## `mode` (type: `string`):

Operation mode: search packages, fetch a specific package, get popular packages, or view statistics.

## `query` (type: `string`):

Keyword or phrase to search for packages (mode=search). E.g. `symfony`, `laravel`, `guzzle`.

## `vendorPackage` (type: `string`):

Package in `vendor/package` format (mode=byVendorPackage). E.g. `symfony/console`.

## `packageType` (type: `string`):

Filter search results by package type (optional, mode=search).

## `tags` (type: `array`):

Filter by tags (mode=search). E.g. \["psr-7", "http"].

## `maxItems` (type: `integer`):

Maximum number of packages to return.

## Actor input object example

```json
{
  "mode": "search",
  "query": "symfony",
  "vendorPackage": "symfony/console",
  "packageType": "",
  "tags": [],
  "maxItems": 50
}
```

# Actor output Schema

## `packages` (type: `string`):

Dataset containing all scraped Packagist packages.

# 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 = {
    "mode": "search",
    "query": "symfony",
    "vendorPackage": "symfony/console",
    "packageType": "",
    "tags": [],
    "maxItems": 50
};

// Run the Actor and wait for it to finish
const run = await client.actor("crawlerbros/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 = {
    "mode": "search",
    "query": "symfony",
    "vendorPackage": "symfony/console",
    "packageType": "",
    "tags": [],
    "maxItems": 50,
}

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

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

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

```

## CLI example

```bash
echo '{
  "mode": "search",
  "query": "symfony",
  "vendorPackage": "symfony/console",
  "packageType": "",
  "tags": [],
  "maxItems": 50
}' |
apify call crawlerbros/packagist-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=crawlerbros/packagist-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Packagist Scraper",
        "description": "Scrape Packagist.org, the main PHP package repository with 400K+ packages. Search by keyword, fetch specific packages, browse popular packages, and get repository statistics.",
        "version": "1.0",
        "x-build-id": "PzWRY9qxEQkQeOObk"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/crawlerbros~packagist-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-crawlerbros-packagist-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/crawlerbros~packagist-scraper/runs": {
            "post": {
                "operationId": "runs-sync-crawlerbros-packagist-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/crawlerbros~packagist-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-crawlerbros-packagist-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "mode"
                ],
                "properties": {
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "search",
                            "byVendorPackage",
                            "popular",
                            "statistics"
                        ],
                        "type": "string",
                        "description": "Operation mode: search packages, fetch a specific package, get popular packages, or view statistics.",
                        "default": "search"
                    },
                    "query": {
                        "title": "Search query",
                        "type": "string",
                        "description": "Keyword or phrase to search for packages (mode=search). E.g. `symfony`, `laravel`, `guzzle`.",
                        "default": "symfony"
                    },
                    "vendorPackage": {
                        "title": "Vendor/Package",
                        "type": "string",
                        "description": "Package in `vendor/package` format (mode=byVendorPackage). E.g. `symfony/console`."
                    },
                    "packageType": {
                        "title": "Package type",
                        "enum": [
                            "",
                            "library",
                            "project",
                            "metapackage",
                            "composer-plugin",
                            "symfony-bundle"
                        ],
                        "type": "string",
                        "description": "Filter search results by package type (optional, mode=search).",
                        "default": ""
                    },
                    "tags": {
                        "title": "Tags (filter)",
                        "type": "array",
                        "description": "Filter by tags (mode=search). E.g. [\"psr-7\", \"http\"].",
                        "default": [],
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxItems": {
                        "title": "Max items",
                        "minimum": 1,
                        "maximum": 1000,
                        "type": "integer",
                        "description": "Maximum number of packages to return.",
                        "default": 50
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
