Re: [DISCUSSION] Native UUID support in PHP
| From: | Christoph M. Becker | Date: | Mon, 16 Mar 2020 16:10:25 +0000 |
| Subject: | Re: [DISCUSSION] Native UUID support in PHP | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109067@lists.php.net to get a copy of this message | ||
On 16.03.2020 at 17:06, Aran Reeks wrote:
> I'd like to open up a discussion around the implementation of a new
> function within PHP for generating a UUID.
>
> Whilst there are libraries out there already for PHP which can generate a
> UUID, all of those libraries have the possibility to generate IDs that
> *could* have a collision.
>
> The specification for UUID versions 1 and 2 allow for collision-free ID
> generation by incorporating the unique MAC addresses from network cards -
> something which can't be accessed from PHP code at present.
>
> I can see two possible methods to enable this;
>
> - New function added to PHP which exposes the MAC address (allowing
> external implementations for UUIDs, as well as other possible purposes a
> MAC address could be used).
>
> - A new PHP function which introduced a uuid() function which will
> generate and return version-compliant UUIDs.
>
> - Both of the above.
>
> Thoughts and feedback welcome to kickstart conversations and if there's a
> positive consensus, I'd like to put forward an RFC for this to be
> introduced in PHP 8.
See also <https://wiki.php.net/rfc/uuid>.
--
Christoph M. Becker