PHPackages                             tankfairies/guid - 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. tankfairies/guid

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

tankfairies/guid
================

GUID Generator

2.0.3(2y ago)01.5k[1 PRs](https://github.com/tankfairies/guid/pulls)1MITPHPPHP ^8.2

Since Jul 15Pushed 1y agoCompare

[ Source](https://github.com/tankfairies/guid)[ Packagist](https://packagist.org/packages/tankfairies/guid)[ Docs](https://tankfairies.com/)[ RSS](/packages/tankfairies-guid/feed)WikiDiscussions 2.0 Synced 2d ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (1)

[![Latest Stable Version](https://camo.githubusercontent.com/52e97c88937c446c95dcd1b87054cba868418a7a57c2e6e8fd7d19d16d2ed41f/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f677569642f762f737461626c65)](https://packagist.org/packages/tankfairies/guid)[![Total Downloads](https://camo.githubusercontent.com/c4bf2cb83bd280bb82c3d889e22ba8f17eb27d6d3e2797642e6359dc8db5f125/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f677569642f646f776e6c6f616473)](https://packagist.org/packages/tankfairies/guid)[![Latest Unstable Version](https://camo.githubusercontent.com/7d50f55b7a20bdbaab39b27cad4d3e3bcc3d5e803c128aaabede08aa5b2b5fe4/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f677569642f762f756e737461626c65)](https://packagist.org/packages/tankfairies/guid)[![License](https://camo.githubusercontent.com/a9916f44433d9ec04d064402375600712d0217f005f60a0e0025a60972c49d91/68747470733a2f2f706f7365722e707567782e6f72672f74616e6b666169726965732f677569642f6c6963656e7365)](https://packagist.org/packages/tankfairies/guid)[![Build Status](https://camo.githubusercontent.com/620251a27c312b6dd05dd38e3816269e7a4b8d1633a52912dc0685b55d09dbd3/68747470733a2f2f7472617669732d63692e636f6d2f74616e6b666169726965732f677569642e7376673f6272616e63683d322e30)](https://travis-ci.com/github/tankfairies/guid)

GUID
====

[](#guid)

It's PHP 7.1+ (master) and PHP 8.2 (2.0) library for generating and working with \[RFC 4122\]\[rfc4122\] version 1, 3, 4, and 5 universally unique identifiers (UUID) / globally unique identifiers (GUID).

Derived from code by [Fredrik Lindberg](https://github.com/fredriklindberg).

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

[](#installation)

Install with [Composer](https://getcomposer.org/):

```
composer require tankfairies/guid
```

API documentation
-----------------

[](#api-documentation)

The \[latest class API documentation\]\[apidocs\] is available online.

Usage
-----

[](#usage)

There are four GUID types available. GUID Version: -

```
    GuidInterface::UUID_TIME      -> Time based UUID        (version 1)
    GuidInterface::UUID_NAME_MD5  -> Name based (MD5) UUID  (version 3)
    GuidInterface::UUID_RANDOM    -> Random UUID            (version 4)
    GuidInterface::UUID_NAME_SHA1 -> Name based (SHA1) UUID (version 5)

```

All the GUIDs can be generated in one of three formats String, binary and byte. GUID format: -

```
    GuidInterface::FMT_STRING
    GuidInterface::FMT_BINARY
    GuidInterface::FMT_BYTE

```

The guid generate function has four parameters: -

```
$guid->generate(
    version,
    format,
    salt,
    namespace
)

```

The salt needs to be at least 6 characters long.

A salt is required for versions 1 but optional for versions 3 and 5.

Generate a Version one GUID. (The third parameter is a salt and is required).

```
use Tankfairies\Guid\Guid;

$guid = new Guid();
$guidToken = $guid->generate(
    GuidInterface::UUID_TIME,
    GuidInterface::FMT_STRING,
    'thesalt'
);
```

Generate a Version three GUID.

```
use Tankfairies\Guid\Guid;

$guid = new Guid();
$guidToken = $guid->generate(
    GuidInterface::UUID_NAME_MD5,
    GuidInterface::FMT_STRING,
    'thesalt',
    'thenamespace'
);
```

Generate a Version four GUID.

```
use Tankfairies\Guid\Guid;

$guid = new Guid();
$guidToken = $guid->generate(
    GuidInterface::UUID_RANDOM,
    GuidInterface::FMT_STRING
);
```

Generate a Version five GUID.

```
use Tankfairies\Guid\Guid;

$guid = new Guid();
$guidToken = $guid->generate(
    GuidInterface::UUID_NAME_SHA1,
    GuidInterface::FMT_STRING
);
```

Copyright and license
---------------------

[](#copyright-and-license)

The tankfairies/guid library is Copyright (c) 2019 Tankfairies () and licensed for use under the MIT License (MIT).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 84.8% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~167 days

Recently: every ~1 days

Total

11

Last Release

819d ago

Major Versions

v1.2 → 2.0.02024-02-09

PHP version history (3 changes)v1.0.0PHP ^7.2

v1.2PHP ^7.4

2.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/761e80f0c4632541e235d7d45128d65ace90c65e3c799c11c36a120155eaad58?d=identicon)[tankfairies](/maintainers/tankfairies)

---

Top Contributors

[![tankfairies](https://avatars.githubusercontent.com/u/50480804?v=4)](https://github.com/tankfairies "tankfairies (28 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")

---

Tags

guid

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/tankfairies-guid/health.svg)

```
[![Health](https://phpackages.com/badges/tankfairies-guid/health.svg)](https://phpackages.com/packages/tankfairies-guid)
```

###  Alternatives

[ramsey/uuid

A PHP library for generating and working with universally unique identifiers (UUIDs).

12.6k700.2M3.3k](/packages/ramsey-uuid)[pascaldevink/shortuuid

PHP 7.4+ library that generates concise, unambiguous, URL-safe UUIDs

5951.8M15](/packages/pascaldevink-shortuuid)[emadadly/laravel-uuid

laravel uuid a simple, automatic UUID generator for any model based on Laravel.

120415.9k3](/packages/emadadly-laravel-uuid)[keiko/uuid-shortener

A simple shortener library for RFC 4122 compatible UUIDs. Change your 36 chars long UUID into it's shorter equivalent.

150215.4k2](/packages/keiko-uuid-shortener)[oittaa/uuid

A small PHP class for generating RFC 9562 universally unique identifiers (UUID) from version 3 to version 8.

50302.7k5](/packages/oittaa-uuid)[thamtech/yii2-uuid

Yii 2 UUID Helper

35347.9k7](/packages/thamtech-yii2-uuid)

PHPackages © 2026

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