1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00

Expose PHP version support states as JSON (#785)

This commit is contained in:
Thomas Jarrand
2023-06-22 18:35:32 +02:00
committed by GitHub
parent 8a48cca42f
commit 558f2f9386

30
releases/states.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
$_SERVER['BASE_PAGE'] = 'releases/active.php';
include_once __DIR__ . '/../include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
header('Content-Type: application/json; charset=UTF-8');
$states = [];
function formatDate($date = null) {
return $date !== null ? $date->format('c') : null;
}
foreach (get_all_branches() as $major => $releases) {
$states[$major] = [];
foreach ($releases as $branch => $release) {
$states[$major][$branch] = [
'state' => get_branch_support_state($branch),
'initial_release' => formatDate(get_branch_release_date($branch)),
'active_support_end' => formatDate(get_branch_bug_eol_date($branch)),
'security_support_end' => formatDate(get_branch_security_eol_date($branch)),
];
}
krsort($states[$major]);
}
krsort($states);
echo json_encode($states);