PHPackages                             greencape/php-versions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. greencape/php-versions

ActiveLibrary

greencape/php-versions
======================

A utility class to provide a list of all PHP versions and their matching xDebug version.

1.5.0(5y ago)069[1 PRs](https://github.com/GreenCape/php-versions/pulls)MITPHPPHP &gt;=7.4CI passing

Since Oct 15Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/GreenCape/php-versions)[ Packagist](https://packagist.org/packages/greencape/php-versions)[ Docs](https://github.com/GreenCape/php-versions)[ RSS](/packages/greencape-php-versions/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (14)Used By (0)

GreenCape/php-versions
======================

[](#greencapephp-versions)

[![Code Climate](https://camo.githubusercontent.com/26a07e5d07324a8c29adb14c6f421f198b0463794d4106307cfef59e11ee82ba/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f477265656e436170652f7068702d76657273696f6e732f6261646765732f6770612e737667)](https://codeclimate.com/github/GreenCape/php-versions)[![Latest Stable Version](https://camo.githubusercontent.com/65b197cbc940a5869faa02ac996fa379f350f1e2369d0e33b267613faffaaa1f/68747470733a2f2f706f7365722e707567782e6f72672f477265656e436170652f7068702d76657273696f6e732f762f737461626c652e706e67)](https://packagist.org/packages/GreenCape/php-versions)[![standard-readme compliant](https://camo.githubusercontent.com/85a8df07cdb7b52c6d19aa103678fed76e6ba8467339b03824405d23c71bf2d7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374616e646172642d2d726561646d652d4f4b2d677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/RichardLitt/standard-readme)

> A utility class to provide a list of all PHP versions and their matching xDebug version.

*GreenCape/php-versions* is designed for use in automated build environments, as it provides the download information for any (stable) PHP version since 3.0.18.

Table of Contents
-----------------

[](#table-of-contents)

- [Install](#install)
- [Usage on the Command Line](#usage-on-the-command-line)
- [Usage as PHP Class](#usage-as-php-class)
- [API](#api)
- [Contribute](#contribute)
- [License](#license)

Install
-------

[](#install)

*GreenCape/php-versions* requires **PHP 7.4+** with **remote file access**, and comes with **no dependencies** except the Symfony console.

Either download this repository and copy `src/php-versions.php` to your project, or use `composer` (recommended):

```
$ composer require GreenCape/php-versions
```

Usage on the Command Line
-------------------------

[](#usage-on-the-command-line)

### General Info

[](#general-info)

Show information about a PHP version

```
$ php-versions [options] [--] []

```

ArgumentDescriptionphpThe PHP version to get the info for. Defaults to 'latest'OptionDescription-f, --format\[=FORMAT\]The output format. Supported values are 'dump' (default), 'json'### Download URLs

[](#download-urls)

Get the filename or download URL for a PHP version or its signature file

```
$ php-versions download-url [options] [--] []
```

ArgumentDescriptionphpThe PHP version to get the info for. Defaults to 'latest'OptionDescription--ascGet the URL for the signature file instead of the PHP source-f, --format\[=FORMAT\]The requested compression format, one of 'bz2', 'gz', or 'xz'-u, --urlIf set, the full URL is returned. if not, just the filename### GPG Keys

[](#gpg-keys)

Get the GPG keys for a PHP distribution file

```
$ php-versions gpg []
```

ArgumentDescriptionphpThe PHP version to get the info for. Defaults to 'latest'### Hashes

[](#hashes)

Get the sha256 or md5 hash for a PHP distribution file

```
$ php-versions hash [options] [--] []
```

ArgumentDescriptionphpThe PHP version to get the info for. Defaults to 'latest'OptionDescription-f, --format\[=FORMAT\]The requested compression format, one of 'bz2', 'gz', or 'xz'-t, --type\[=TYPE\]The requested hash type, one of 'sha256' (default) or 'md5'### Versions

[](#versions)

Show full version number of a PHP version.

```
$ php-versions version []
```

ArgumentDescriptionphpThe PHP version to get the info for. Defaults to 'latest'Usage as PHP Class
------------------

[](#usage-as-php-class)

The simplest use-case is to determine the current (latest) version of PHP:

```
$versions = new GreenCape\PhpVersions();

$latest = $versions->getInfo();
print_r($latest);
```

This will output

```
Array
(
    [version] => 8.0.1
    [aliases] => Array
        (
            [0] => latest
            [1] => 8
            [2] => 8.0
        )

    [announcement] => 1
    [date] => 2021-01-07
    [source] => Array
        (
            [gz] => Array
                (
                    [filename] => php-8.0.1.tar.gz
                    [name] => PHP 8.0.1 (tar.gz)
                    [sha256] => f1fee0429aa2cce6bc5df5d7e65386e266b0aab8a5fad7882d10eb833d2f5376
                    [md5] =>
                )

            [bz2] => Array
                (
                    [filename] => php-8.0.1.tar.bz2
                    [name] => PHP 8.0.1 (tar.bz2)
                    [sha256] => c44e76af40d133de64564f9caf5daec52bbe84c1ccb4e4500a62233d614ebdee
                    [md5] =>
                )

            [xz] => Array
                (
                    [filename] => php-8.0.1.tar.xz
                    [name] => PHP 8.0.1 (tar.xz)
                    [sha256] => 208b3330af881b44a6a8c6858d569c72db78dab97810332978cc65206b0ec2dc
                    [md5] =>
                )

        )

    [museum] =>
    [xdebug] => Array
        (
            [version] => 3.0.2
            [sha256] => 096d46dec061341868d3e3933b977013a592e2e88992b2c0aba7fa52f87c4e17
        )

    [gpg] => Array
        (
            [0] => Array
                (
                    [pub] => 1729 F839 38DA 44E2 7BA0  F4D3 DBDB 3974 70D1 2172
                    [uid] => Sara Golemon
                )

            [1] => Array
                (
                    [pub] => BFDD D286 4282 4F81 18EF  7790 9B67 A5C1 2229 118F
                    [uid] => Gabriel Caruso (Release Manager)
                )

        )

)

```

*GreenCape/php-versions* provides a couple of access methods. See [Examples](#examples) and [API](#api) sections for more information.

### Examples

[](#examples)

**Get the latest release**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getInfo();
echo $info['version']; // 8.0.1
```

**Get the latest release of the 5.5 branch**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getInfo('5.5');
echo $info['version']; // 5.5.38
```

**Get the latest release of version 4**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getInfo('4');
echo $info['version']; // 4.4.9
```

**Get all release numbers of the 4.4 branch**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getVersions('4.4');
print_r($info);
```

Output:

```
Array
(
    [0] => 4.4.9
    [1] => 4.4.8
    [2] => 4.4.7
    [3] => 4.4.6
    [4] => 4.4.5
    [5] => 4.4.4
    [6] => 4.4.3
    [7] => 4.4.2
    [8] => 4.4.1
    [9] => 4.4.0
)

```

**Get the download info for PHP 5.2.9**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getSourceInfo('5.2.9');
print_r($info);
```

Output:

```
Array
(
    [filename] => php-5.2.9.tar.bz2
    [name] => PHP 5.2.9 (tar.bz2)
    [md5] => 280d6cda7f72a4fc6de42fda21ac2db7
    [sha256] =>
)

```

**Get the GPG key(s) for PHP 5.4**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getGpgInfo('5.4');
print_r($info);
```

Output:

```
Array
(
    [0] => Array
        (
            [pub] => F382 5282 6ACD 957E F380  D39F 2F79 56BC 5DA0 4B5D
            [uid] => Stanislav Malyshev (PHP key)
        )
)

```

**Get the XDebug information for PHP 5.4**

```
$versions = new GreenCape\PhpVersions();

$info = $versions->getXdebugInfo('5.4');
print_r($info);
```

Output:

```
Array
(
    [version] => 2.4.1
    [sha1] => 52b5cede5dcb815de469d671bfdc626aec8adee3
)

```

API
---

[](#api)

See separate [API documentation](docs/API.md).

Contribute
----------

[](#contribute)

PRs are welcome. If you encounter any bug or issues, please use the [issue tracker](https://github.com/GreenCape/php-versions/issues).

License
-------

[](#license)

[The MIT license (MIT)](LICENSE.md).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance54

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~339 days

Total

12

Last Release

1940d ago

PHP version history (2 changes)v1.0.0PHP &gt;=5.4

1.5.0PHP &gt;=7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/84f7f05685e84e3fe971d8d005bb74e766204799c50a7b45036af27436cecddc?d=identicon)[GreenCape](/maintainers/GreenCape)

---

Top Contributors

[![nibra](https://avatars.githubusercontent.com/u/827605?v=4)](https://github.com/nibra "nibra (29 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/greencape-php-versions/health.svg)

```
[![Health](https://phpackages.com/badges/greencape-php-versions/health.svg)](https://phpackages.com/packages/greencape-php-versions)
```

###  Alternatives

[phan/phan

A static analyzer for PHP

5.6k11.2M1.1k](/packages/phan-phan)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-soap/wsdl

Deals with WSDLs

173.5M12](/packages/php-soap-wsdl)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
