src/IdempotencyTokenMiddleware.php
private static function getUuidV4($bytes)
    {
        // set version to 0100
        $bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);
        // set bits 6-7 to 10
        $bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);
        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($bytes), 4));
    }
private static function getUuidV4($bytes)
    {
        // set version to 0100
        $bytes[6] = chr(ord($bytes[6]) & 0x0f | 0x40);
        // set bits 6-7 to 10
        $bytes[8] = chr(ord($bytes[8]) & 0x3f | 0x80);
        return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($bytes), 4));
    }
private static function getUuidV4 ( $ bytes ) { // set version to 0100 $ bytes [ 6 ] = chr ( ord ( $ bytes [ 6 ] ) & 0x0f | 0x40 ) ; // set bits 6-7 to 10 $ bytes [ 8 ] = chr ( ord ( $ bytes [ 8 ] ) & 0x3f | 0x80 ) ; return vsprintf ( '%s%s-%s-%s-%s-%s%s%s' , str_split ( bin2hex ( $ bytes ) , 4 ) ) ; }
This function generates a random UUID v4 string,
which is used as auto filled token value.

@param string $bytes 16 bytes of pseudo-random bytes
@return string
More information about UUID v4, see:
https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_.28random.29
https://tools.ietf.org/html/rfc4122#page-14
This function generates a random UUID v4 string which is used as auto filled token value .