How to Generate a UUID in PHP 7
Here is a little snippet for generating a UUID in PHP 7
function uuid(){
$data = random_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
$data[8] = chr(ord($data[8]) & 0x3f | 0x80);
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_...
Written by Sean Behan on 10/26/2017
How to Enable UUIDs in Postgres
The first thing you'll need to do is enable the extension
create extension "uuid-ossp";
To test that it's working
select uuid_generate_v1();
For more info on which version of the algorithm you should use refer to the documentation.
...
Written by Sean Behan on 03/03/2017