PHPackages                             sebastian/uuid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. sebastian/uuid

ActiveLibrary[Testing &amp; Quality](/categories/testing)

sebastian/uuid
==============

Function for generating a UUID (as string)

1.0.2(1y ago)271.0k↓50%BSD-3-ClausePHPPHP &gt;=8.1CI passing

Since Mar 21Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/sebastianbergmann/uuid)[ Packagist](https://packagist.org/packages/sebastian/uuid)[ Docs](https://github.com/sebastianbergmann/uuid)[ GitHub Sponsors](https://github.com/sebastianbergmann)[ RSS](/packages/sebastian-uuid/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/60bd1df061ab7a6905381b2c6b6b279ac42e3c3926da9f3385b404ac411d1c21/68747470733a2f2f706f7365722e707567782e6f72672f73656261737469616e2f757569642f76)](https://packagist.org/packages/sebastian/uuid)[![CI Status](https://github.com/sebastianbergmann/uuid/workflows/CI/badge.svg)](https://github.com/sebastianbergmann/uuid/actions)[![codecov](https://camo.githubusercontent.com/ced9c1c0078267856443f1e92732f121b81b225b40cc5bc7ae36bc4bbfbd7491/68747470733a2f2f636f6465636f762e696f2f67682f73656261737469616e626572676d616e6e2f757569642f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/sebastianbergmann/uuid)

sebastian/uuid
==============

[](#sebastianuuid)

This package provides a single function: `uuid()`. This function uses PHP's `random_bytes()` function to generate a string that contains a 16-byte number written in hexadecimal and divided into five groups of characters (8-4-4-4-12).

Strings generated using the `uuid()` function can be used as Universally Unique Identifiers (UUIDs) in certain contexts.

Installation
------------

[](#installation)

You can add this library as a local, per-project dependency to your project using [Composer](https://getcomposer.org/):

```
composer require sebastian/uuid

```

If you only need this library during development, for instance to run your project's test suite, then you should add it as a development-time dependency:

```
composer require --dev sebastian/uuid

```

Usage
-----

[](#usage)

```
