mirror of
https://github.com/php/web-downloads.git
synced 2026-03-23 23:32:07 +01:00
9.1 KiB
9.1 KiB
API
Base URL
- All endpoints are routed via
public/index.php.
Authentication
- Endpoints marked with Auth: Required require a bearer token header:
- Header:
Authorization: Bearer <AUTH_TOKEN>
- Header:
Content type
- For POST endpoints, send
Content-Type: application/jsonand a valid JSON body.- Invalid/malformed JSON will cause a decoding error (JSON exception) and the request will fail.
Errors
- 200 OK: Successful request (body may be empty).
- 400 Bad Request: Validation failed. Response body starts with
Invalid request:and includes per-field errors. - 401 Unauthorized: Missing/invalid bearer token on protected endpoints.
- 404 Not Found: No route matches the requested path.
- 405 Method Not Allowed: Path exists but HTTP method is not allowed; response lists allowed methods.
- 500 Internal Server Error: Uncaught errors (e.g., download failure, malformed JSON, or other exceptions).
GET /api/list-builds
- Auth: Required
- Purpose: List builds artifacts pending for processing in the
BUILDS_DIRECTORY. - Request body: none (GET request).
- Success:
200 OKwith JSON payload{ "builds": [ { "path": "relative/path", "size": 1234, "modified": "2025-09-30T12:34:56+00:00" }, ... ] }. - Errors:
401if the bearer token is missing or invalid.500with{ "error": "Builds directory not configured or missing." }ifBUILDS_DIRECTORYis unset or the directory does not exist.
Example
curl -i -X GET \
-H "Authorization: Bearer $AUTH_TOKEN" \
https://downloads.php.net/api/list-builds
POST /api/delete-pending-job
- Auth: Required
- Purpose: Remove a queued build job before it is processed.
- Request body (JSON):
type(string, required): One ofphp,pecl, orwinlibs.job(string, required): The job filename (forphp/pecl) or directory name (forwinlibs).
- Success:
200 OKwith{ "status": "deleted" }. - Errors:
400if validation fails (missing/invalid fields).404if the job could not be found.500ifBUILDS_DIRECTORYis not configured or the delete operation fails.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"type": "php",
"job": "php-abc123.zip"
}' \
https://downloads.php.net/api/delete-pending-job
POST /api/php
- Auth: Required
- Purpose: Upload PHP build artifact from a URL.
- Request body (JSON):
url(string, required, URL): Direct download URL of the artifact.token(string, required): Used as a GitHub token if the URL points toapi.github.com.
- Success:
200 OK. - Errors:
400with validation details ifurlortokenare missing/invalid.500withError: ...if the file could not be fetched or is not a ZIP.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.github.com/repos/org/repo/actions/artifacts/123/zip",
"token": "ghp_..."
}' \
https://downloads.php.net/api/php
POST /api/pecl
- Auth: Required
- Purpose: Upload a PECL extension artifact.
- Request body (JSON):
url(string, required, URL): Direct download URL of the artifact.extension(string, required): Extension name (used in filename).ref(string, required): Reference (e.g., tag/commit) used in filename.token(string, required): Used as a GitHub token if the URL points toapi.github.com.
- Success:
200 OK. - Errors:
400with validation details if required fields are missing/invalid.500withError: ...if the file could not be fetched or is not a ZIP.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"url": "https://api.github.com/repos/org/repo/actions/artifacts/456/zip",
"extension": "xdebug",
"ref": "3.3.2",
"token": "ghp_..."
}' \
https://downloads.php.net/api/pecl
POST /api/winlibs
- Auth: Required
- Purpose: Record metadata and fetch all artifacts for a specific GitHub Actions workflow run of
winlibs/winlib-builder. - Request body (JSON):
library(string, required): matching^[a-zA-Z0-9_-]+$ref(string, required)type(string, required):php, orpecl.workflow_run_id(string, required)php_versions(string, required): Comma-separated list matching^(?:\d+\.\d+|master)(?:,\s*(?:\d+\.\d+|master))*$.vs_version_targets(string, required): Comma-separated list matching^(v[c|s]\d{2})(,v[c|s]\d{2})*$.stability(string, required):stable,staging, or both (comma-separated) matching^(stable|staging)(,(stable|staging))?$.token(string, required): GitHub token used to download artifacts.
- Success:
200 OK, empty body. - Errors:
400with validation details if input is invalid.- Other failures are printed as cURL errors; HTTP status may still be 200 if not explicitly set.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"library": "icu",
"ref": "main",
"workflow_run_id": "1234567890",
"php_versions": "8.1,8.2,8.3",
"vs_version_targets": "vc15,vs16",
"stability": "stable",
"token": "ghp_..."
}' \
https://downloads.php.net/api/winlibs
POST /api/series-init
- Auth: Required
- Purpose: Initialize a series configuration by writing a JSON file into
BUILDS_DIRECTORY/series. - Request body (JSON):
php_version(string, required): Matches^\d+.\d+$.source_vs(string, required): Matches^v[c|s]\d{2}$.target_vs(string, required): Matches^v[c|s]\d{2}$.
- Success:
200 OK, empty body. - Errors:
400with validation details if input is invalid.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"php_version": "8.4",
"source_vs": "vc15",
"target_vs": "vs16"
}' \
https://downloads.php.net/api/series-init
POST /api/series-delete
- Auth: Required
- Purpose: Queue deletion of existing series files.
- Request body (JSON):
php_version(string, required): Matches^(\d+\.\d+|master)$.vs_version(string, required): Matches^v[c|s]\d{2}$.
- Success:
200 OK, empty body. - Errors:
400with validation details if input is invalid.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"php_version": "8.3",
"vs_version": "vs16"
}' \
https://downloads.php.net/api/series-delete
POST /api/series-update
- Auth: Required
- Purpose: Update a library entry in a series packages file, or remove it entirely.
- Request body (JSON):
php_version(string, required): Matches^(\d+\.\d+|master)$.vs_version(string, required): Matches^v[c|s]\d{2}$.stability(string, required): Eitherstableorstaging.library(string, required): Library identifier to update/remove.ref(string, required but may be empty): Matches^([a-zA-Z0-9\.-]+)?$, When non-empty, updates/creates entries named<library>-<ref>-<vs_version>-<arch>.zipfor bothx86andx64; when empty, removes the library from both files if present.
- Success:
200 OK, empty body. - Errors:
400with validation details if the payload is invalid.500ifBUILDS_DIRECTORYis not configured on the server.
Example (update)
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"php_version": "8.2",
"vs_version": "vs16",
"arch": "x64",
"stability": "stable",
"library": "libxml2",
"ref": "2.9.15"
}' \
https://downloads.php.net/api/series-update
Example (remove)
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"php_version": "8.2",
"vs_version": "vs16",
"arch": "x64",
"stability": "stable",
"library": "libxml2",
"ref": ""
}' \
https://downloads.php.net/api/series-update
POST /api/series-stability
- Auth: Required
- Purpose: Promote the staging series files to stable.
- Request body (JSON):
php_version(string, required): Matches^(\d+\.\d+|master)$.vs_version(string, required): Matches^v[c|s]\d{2}$.
- Success:
200 OK, empty body. - Errors:
400with validation details if input is invalid.
Example
curl -i -X POST \
-H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"php_version": "8.3",
"vs_version": "vs16"
}' \
https://downloads.php.net/api/series-stability