Skip to content

Add API for QA #1262

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,69 @@ paths:
type: string
format: date-time

"/release-candidates.php":
get:
summary: "Currently RC versions of PHP."
parameters:
- in: query
name: format
schema:
type: string
enum: [ "json", "serialize" ]
required: false
description: Output format
- in: query
name: only
schema:
type: string
enum: [ "dev_versions" ]
required: false
description: Include only dev version numbers

responses:
"200":
description: "Actively RC per-branch versions of PHP."
content:
"application/json":
schema:
type: array
items:
type: object
properties:
active:
description: "Whether RC version is active"
type: boolean
release:
type: object
properties:
type:
description: "Unstable release type"
type: string
enum:
- alpha
- beta
- RC
number:
description: "Unstable release number"
type: integer
sha256_gz:
description: "Unstable release gz hash"
type: string
sha256_bz2:
description: "Unstable release bz2 hash"
type: string
sha256_xz:
description: "Unstable release xz hash"
type: string
date:
description: "Date of release"
type: string
baseurl:
description: "Download base URL"
type: string
enabled:
description: "enabled"
type: boolean
dev_version:
description: "dev_version"
type: string
27 changes: 27 additions & 0 deletions release-candidates.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@
include_once __DIR__ . '/include/prepend.inc';
include_once __DIR__ . '/include/release-qa.php';

if (isset($_GET["format"])) {
$output = $QA_RELEASES;

if (($_GET['only'] ?? null) === 'dev_versions') {
$output = $output['reported'];
}

switch ($_GET['format'] ?? null) {
case 'json':
header('Content-Type: application/json; charset=UTF-8');
echo json_encode($output);
exit;
case 'serialize':
default:
header('Content-Type: text/plain; charset=UTF-8');
echo serialize($output);
exit;
}
}

$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));

$SIDEBAR_DATA = '
Expand All @@ -17,6 +37,13 @@
builds, please file a report on <a
href="https://github.com/php/php-src/issues/">GitHub Issues</a>.
</div>
<div class="body">
<p>The QA API is simple, and is based on the query string. Pass in <code>only=dev-versions</code> (the only type currently), along with the desired format (<code>serialize</code> or <code>json</code>).</p>
<ul>
<li>All information, serialized: https://php.net/release-candidates.php?format=serialize</li>
<li>Only dev version numbers, json: https://php.net/release-candidates.php?format=json&only=dev_versions</li>
</ul>
</div>
</div>
';

Expand Down