Documentation

functions.php

This file is part of the ramsey/uuid library

For the full copyright and license information, please view the LICENSE file that was distributed with this source code.

Tags
copyright

Copyright (c) Ben Ramsey ben@benramsey.com

license

http://opensource.org/licenses/MIT MIT

Table of Contents

v1()  : string
Generate a version 1 UUID from a host ID, sequence number, and the current time.
v3()  : string
Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which is a UUID) and a name (which is a string).
v4()  : string
Generate a version 4 (random) UUID.
v5()  : string
Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which is a UUID) and a name (which is a string).

Functions

v1()

Generate a version 1 UUID from a host ID, sequence number, and the current time.

v1([int|string|null $node = null ][, int|null $clockSeq = null ]) : string
Parameters
$node : int|string|null = null

A 48-bit number representing the hardware address This number may be represented as an integer or a hexadecimal string.

$clockSeq : int|null = null

A 14-bit number used to help avoid duplicates that could arise when the clock is set backwards in time or if the node ID changes.

Tags
throws
UnsatisfiedDependencyException

if called on a 32-bit system and Moontoast\Math\BigNumber is not present

throws
InvalidArgumentException
throws
Exception

if it was not possible to gather sufficient entropy

Return values
string

v3()

Generate a version 3 UUID based on the MD5 hash of a namespace identifier (which is a UUID) and a name (which is a string).

v3(string|UuidInterface $ns, string $name) : string
Parameters
$ns : string|UuidInterface

The UUID namespace in which to create the named UUID

$name : string

The name to create a UUID for

Tags
throws
InvalidUuidStringException
Return values
string

v4()

Generate a version 4 (random) UUID.

v4() : string
Tags
throws
UnsatisfiedDependencyException

if Moontoast\Math\BigNumber is not present

throws
InvalidArgumentException
throws
Exception
Return values
string

v5()

Generate a version 5 UUID based on the SHA-1 hash of a namespace identifier (which is a UUID) and a name (which is a string).

v5(string|UuidInterface $ns, string $name) : string
Parameters
$ns : string|UuidInterface

The UUID namespace in which to create the named UUID

$name : string

The name to create a UUID for

Tags
throws
InvalidUuidStringException
Return values
string

Search results