mirror of
https://github.com/ramsey/uuid.git
synced 2026-06-26 17:46:38 +03:00
feat: add UUIDv7 documentation and customization
This commit is contained in:
@@ -15,6 +15,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Ramsey\Uuid;
|
||||
|
||||
use DateTimeInterface;
|
||||
use Ramsey\Uuid\Type\Hexadecimal;
|
||||
use Ramsey\Uuid\Type\Integer as IntegerObject;
|
||||
|
||||
@@ -121,3 +122,17 @@ function v6(?Hexadecimal $node = null, ?int $clockSeq = null): string
|
||||
{
|
||||
return Uuid::uuid6($node, $clockSeq)->toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a version 7 (Unix Epoch time) UUID
|
||||
*
|
||||
* @param DateTimeInterface|null $dateTime An optional date/time from which
|
||||
* to create the version 7 UUID. If not provided, the UUID is generated
|
||||
* using the current date/time.
|
||||
*
|
||||
* @return non-empty-string Version 7 UUID as a string
|
||||
*/
|
||||
function v7(?DateTimeInterface $dateTime = null): string
|
||||
{
|
||||
return Uuid::uuid7($dateTime)->toString();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user