Skip to content

Downgrade the required PHP version #111

@DisboardTetta

Description

@DisboardTetta

Is there really a reason to limit the PHP version to such a high version?

    "require": {
        "php": "^8.1"
    },

After reviewing the source code, I didn't find any syntax specific to PHP 8.1+. According to what I saw, the minimum version for your class is PHP 7.1 due to

Example #4 Class constant visibility modifiers, as of PHP 7.1.0
from the link https://www.php.net/manual/en/language.oop5.constants.php

I decided to try running php-alpine 7.2* on an older version of Docker, using your test example as a basis. I ran the following script:

$uuid3 = UUID::uuid3(UUID::NAMESPACE_DNS, 'php.net');
echo $uuid3; // 11a38b9a-b3da-360f-9353-a5a725514269
echo "<br/>";

// Generate a version 4 (random) UUID
$uuid4 = UUID::uuid4();
echo $uuid4; // e.g. 2140a926-4a47-465c-b622-4571ad9bb378
echo "<br/>";

// Generate a version 5 (name-based and hashed with SHA1) UUID
$uuid5 = UUID::uuid5(UUID::NAMESPACE_DNS, 'php.net');
echo $uuid5; // c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
echo "<br/>";

// Generate a version 6 (lexicographically sortable) UUID
$uuid6_first = UUID::uuid6();
echo $uuid6_first; // e.g. 1ec9414c-232a-6b00-b3c8-9e6bdeced846
$uuid6_second = UUID::uuid6();
var_dump($uuid6_first < $uuid6_second); // bool(true)
echo "<br/>";

// Generate a version 7 (lexicographically sortable) UUID
$uuid7_first = UUID::uuid7();
echo $uuid7_first; // e.g. 017f22e2-79b0-7cc3-98c4-dc0c0c07398f
$uuid7_second = UUID::uuid7();
var_dump($uuid7_first < $uuid7_second); // bool(true)
echo "<br/>";

// Generate a version 8 (lexicographically sortable) UUID
$uuid8_first = UUID::uuid8();
echo $uuid8_first; // e.g. 017f22e2-79b0-8cc3-98c4-dc0c0c07398f
$uuid8_second = UUID::uuid8();
var_dump($uuid8_first < $uuid8_second); // bool(true)
echo "<br/>";
echo PHP_VERSION;

and get next:

11a38b9a-b3da-360f-9353-a5a725514269
d43211db-7d39-4d4c-9887-d64924c248d6
c4a760a8-dbcf-5254-a0d9-6a4474bd1b62
1f0e4b6e-76ec-6178-8f6c-832b2e845cdfbool(true)
019b6a35-c216-71f3-a81b-289741fa7ad8bool(true)
019b6a35-c216-830e-955d-578a47b18513bool(true)
7.2.34

The script's functionality is fully confirmed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions