Skip to content

Instantly share code, notes, and snippets.

@KalleZ
Created July 26, 2017 01:55
Show Gist options
  • Save KalleZ/d98b99fb2a277576938a79683a001b42 to your computer and use it in GitHub Desktop.
Save KalleZ/d98b99fb2a277576938a79683a001b42 to your computer and use it in GitHub Desktop.
supported-versions.php | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/supported-versions.php b/supported-versions.php
index aa95113..0a852be 100644
--- a/supported-versions.php
+++ b/supported-versions.php
@@ -4,6 +4,23 @@ $_SERVER['BASE_PAGE'] = 'supported-versions.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/prepend.inc';
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/branches.inc';
+if (isset($_GET['json']) && $_GET['json']) {
+ $versions = array();
+
+ foreach (get_active_branches(false) as $major => $releases) {
+ ksort($releases);
+
+ foreach ($releases as $branch => $release) {
+ $versions[$branch] = $release['version'];
+ }
+ }
+
+ header('Content-Type: application/json');
+
+ echo json_encode($versions);
+ exit;
+}
+
site_header('Supported Versions', array('css' => array('supported-versions.css')));
// Version notes: if you need to make a note about a version having an unusual
@@ -126,4 +143,11 @@ include $_SERVER['DOCUMENT_ROOT'] . '/images/supported-versions.php';
period has been doubled from one to two years. Other releases are unaffected.
</p>
+<h1>Latest supported versions API</h1>
+
+<p>
+ You can obtain the latest supported versions of PHP through a JSON interface, you can
+ find this interface <a href="/supported-versions.php?json=1">here</a>.
+</p>
+
<?php site_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment