PHPackages                             helicon-os/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. helicon-os/uuid

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

helicon-os/uuid
===============

Generic basic UUID Generator for PHP with various output formats like 16byte binary, hex formats (compact, grouped, ...), base32-like and base64-like. V4 Random UUIDs and Sequential UUIDs can be generated.

112PHP

Since Jun 5Pushed 10y ago1 watchersCompare

[ Source](https://github.com/helicon-os/uuid)[ Packagist](https://packagist.org/packages/helicon-os/uuid)[ RSS](/packages/helicon-os-uuid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

helicon-os/uuid Basic UUID functions for PHP
============================================

[](#helicon-osuuid-basic-uuid-functions-for-php)

Copyright (c) 2015, Andreas Prucha, Helicon Software Development All rights reserved.

Overview
--------

[](#overview)

Provides basic functions to generate UUIDs on the client side. UUIDs can be generated in following formats:

- 16 byte Binary string: Big-Endian binary representation of an uuid
- 32 byte hex string: 32 chacter hex representation without dashes. The default in this library.
- 36 byte hex string: The usual string representation of uuids.
- 38 byte hex string: String representation with braces.
- 45 byte hex string: with urn:uuid-prefix
- 22 byte Base64-like string (Experimental)
- 26 byte Base32-like string (Experimental)

The library supports the following uuid sub-versions:

- V4 Random UUIDs
- "Sequential" V4 Random UIIDs (Time/Random-Based UUIDs inspired by COMB-UUIds, but slightly different)

The default version is V4Asc (Ascending Random)

If more sophisticated functions are necessary, the famous \[\] may be worth a try.

Pitfalls and Limitations
------------------------

[](#pitfalls-and-limitations)

\###Byte Order

This library assumes Network Byte Order (Big Endian) as described in the RFC 4122 in the binary string representation. Unfortunately Microsoft uses Little Endian, thus conversion to the string representation may return another result there. Additionally, On systems using little endian, the V4Asc algorithm does hot have the desired effect.

\###Format

32 char hex strings are used by default which can be stored in CHAR(32) fields. Please make sure that the field uses an 8bit characterset (ASCII) and a collation with no overhead (binary or similar).

Format (Constant)Db Type / charset / collationCommentUtil::FORMAT\_BINBINARY(16) BINARY / BINARYBinaryUtil::FORMAT\_HEX\_SHORTCHAR(32) ASCII / ASCII or binaryJust HexUtil::FORMAT\_HEX\_GROUPEDCHAR(36) ASCII / ASCII or binaryHex + Formatting charactersUtil::FORMAT\_HEX\_FULLCHAR(38) ASCII / ASCII or binaryHex + Formatting charactersUtil::FORMAT\_URNCHAR(45) ASCII / ASCII or binaryHex with urn:uuid:-prefixUtil::FORMAT\_ENC32CHAR(26) ASCII / ASCII or binaryExperimental Base32-like sortable encoding (numbers+lc-chars)Util::FORMAT\_ENC64CHAR(26) ASCII / ASCII or binaryExperimental Base64-like sortable encoding (numbers+alpha)Note about chracter set and collation:

Choosing the right db type, charset and collation can have a huge impact on performance. It's not reccommended to use UTF-8 for a UUID-Field because it's a waste of space and unicode-comparisons are usually slower. Usually the best choice is to use a binary or ASCII-collation and ASCII charset (except for FORMAT\_BIN, which has to be BINARY)

- All encodings are sortable and big-endian.
- All encodings except FORMAT\_BIN are Url-safe
- For all encodings except FORMAT\_BIN it's reccommended to use an ASCII-Character set and a binary collation in order to increase performance
- For all encodings *except* FORMAT\_BIN and FORMAT\_ENC64 it is *possible* to use a case insensitive collation because the string representation are never mixed case, but it should not be done.

Another option is to use the 16byte "binary" format.

Advantage of the 36byte hex format:

- No Endian-Conflict
- Readable using the usual representation
- Easy to use in hand-written queries Disadvantage of 36byte hex format:
- Uses more space
- may be slightly slower

Example
-------

[](#example)

Generating a UUID is quite simple:

```
  $newUuid = \helicon\uuid\Util::generate(); // Generates a new in default format and version
```

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

[](#installation)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2aac759700a1ebf5ceb3bdda6b58776648360d5215fbd53169c70ea6b5b89ada?d=identicon)[ancpru](/maintainers/ancpru)

### Embed Badge

![Health badge](/badges/helicon-os-uuid/health.svg)

```
[![Health](https://phpackages.com/badges/helicon-os-uuid/health.svg)](https://phpackages.com/packages/helicon-os-uuid)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
