PHPackages                             thamtech/yii2-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. thamtech/yii2-uuid

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

thamtech/yii2-uuid
==================

Yii 2 UUID Helper

v1.2.2(5y ago)36365.6k↓41.2%[1 issues](https://github.com/thamtech/yii2-uuid/issues)[1 PRs](https://github.com/thamtech/yii2-uuid/pulls)7Apache-2.0PHPPHP &gt;=5.6.0

Since Oct 8Pushed 2y ago2 watchersCompare

[ Source](https://github.com/thamtech/yii2-uuid)[ Packagist](https://packagist.org/packages/thamtech/yii2-uuid)[ Fund](https://liberapay.com/thamtech)[ RSS](/packages/thamtech-yii2-uuid/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (7)

Yii 2 UUID Helper
-----------------

[](#yii-2-uuid-helper)

UUID Helper and validator for Yii 2.

This library interfaces with [ramsey/uuid](https://github.com/ramsey/uuid) to generate [universally unique identifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier).

For license information check the [LICENSE](LICENSE.md)-file.

[![Latest Stable Version](https://camo.githubusercontent.com/8573a9770fbba7ed11b2419107d26249d80e8945fcbf8a6688adace527f0a003/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7468616d746563682f796969322d757569642e737667)](https://packagist.org/packages/thamtech/yii2-uuid)[![Build Status](https://camo.githubusercontent.com/35f03432b1ef4f8ce6a2588c085c33d3e503d0f5a30e2857cd0a4f7ec62526ec/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7468616d746563682f796969322d757569642e737667)](https://travis-ci.org/thamtech/yii2-uuid)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/8b90743b53108382c7b4390401c8dd899d672a15dee125e7d6777cc4ea5b66ba/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7468616d746563682f796969322d757569642e737667)](https://scrutinizer-ci.com/g/thamtech/yii2-uuid/)[![Code Coverage](https://camo.githubusercontent.com/e8c6c722cfed5758ae778dcba7e79dd65ee8a434aa05a343a885bb5640a6af97/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7468616d746563682f796969322d757569642e737667)](https://scrutinizer-ci.com/g/thamtech/yii2-uuid/)

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

[](#installation)

The preferred way to install this extensions is through [composer](https://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist thamtech/yii2-uuid

```

or add

```
"thamtech/yii2-uuid": "*"

```

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

New UUID
--------

[](#new-uuid)

Generate a new UUID (version 4 by default):

```
$uuid = \thamtech\uuid\helpers\UuidHelper::uuid();
```

Ad-Hoc Validation
-----------------

[](#ad-hoc-validation)

Validate that a string is formatted in the canonical format using hexadecimal text with inserted hyphen characters (case insensitive):

```
$uuid = 'de305d54-75b4-431b-adb2-eb6b9e546014';
$isValid = \thamtech\uuid\helpers\UuidHelper::isValid($uuid); // true

$uuid = 'not-a-uuid';
$isValid = \thamtech\uuid\helpers\UuidHelper::isValid($uuid); // false

// or using the Validator class directly
$validator = new \thamtech\uuid\validators\UuidValidator();
if ($validator->validate($uuid, $error)) {
    // valid
} else {
    // not valid
    echo $error
}
```

Or you can include the `use` lines, especially if you will be making multiple uuid calls within a file:

```
use thamtech\uuid\helpers\UuidHelper;
use thamtech\uuid\helpers\UuidValidator;

// ...

$uuid = 'de305d54-75b4-431b-adb2-eb6b9e546014';
$isValid = UuidHelper::isValid($uuid); // true

$uuid = 'not-a-uuid';
$isValid = UuidHelper::isValid($uuid); // false

// or using the Validator class directly
$validator = new UuidValidator();
if ($validator->validate($uuid, $error)) {
    // valid
} else {
    // not valid
    echo $error
}
```

Field Validation
----------------

[](#field-validation)

Incorporate this same validation into your model:

```
public function rules()
{
    return [
        [['uuid'], 'thamtech\uuid\validators\UuidValidator'],
    ];
}
```

See Also
--------

[](#see-also)

- [ramsey/uuid](https://github.com/ramsey/uuid)
- [Universally unique identifiers](https://en.wikipedia.org/wiki/Universally_unique_identifier)

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~275 days

Recently: every ~253 days

Total

8

Last Release

1991d ago

PHP version history (2 changes)v1.0PHP &gt;=5.4.0

v1.1.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2757540?v=4)[Tyler Ham](/maintainers/tyler-ham)[@tyler-ham](https://github.com/tyler-ham)

---

Top Contributors

[![tyler-ham](https://avatars.githubusercontent.com/u/2757540?v=4)](https://github.com/tyler-ham "tyler-ham (40 commits)")

---

Tags

phpuuidyii2uuidguidyii2yii

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thamtech-yii2-uuid/health.svg)

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

###  Alternatives

[brussens/yii2-maintenance-mode

Maintenance mode component for Yii framework 2.x.x version.

78263.0k5](/packages/brussens-yii2-maintenance-mode)[ekreative/uuid-extra-bundle

Paramconverter, Normalizer and Form Type for Ramsey Uuid

18170.8k](/packages/ekreative-uuid-extra-bundle)

PHPackages © 2026

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