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

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

wartron/yii2-uuid
=================

Yii2 UUID Helpers

124.8k2[1 issues](https://github.com/wartron/yii2-uuid/issues)PHP

Since Sep 20Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2-UUID
=========

[](#yii2-uuid)

Helpers for using uuids as primary keys.

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

[](#installation)

Add the uuid behavior to models.

We could use the SqlExpression to generate the uuid in sql, but we dont get the ID back in last insert id. (We can get around this with triggers if you want a pure SQL method). But generating the ID UUID in php we dont need to worry about getting the id an refreshing the model.

Using our UUID'd ActiveRecord, it will take care of generating the id, and can handle toArray for api calls repersenting the uuid and other uuid fields as in hex.

```
use wartron\yii2uuid\db\ActiveRecord;

```

Using the Behavior for id.

```
public function behaviors()
{
    return [
        \wartron\yii2uuid\behaviors\UUIDBehavior::className(),
    ];
}

```

To use the formater asHex

```
'components' => [
    'formatter' => [
        'class' => '\wartron\yii2uuid\components\Formatter'
    ],
]

```

The Helper providers access to ramsey/uuid. This will automaticly convert to the binary from we use!

```
use wartron\yii2uuid\helpers\Uuid;

//generate uuids
Uuid::uuid1();
Uuid::uuid3();
Uuid::uuid4();
Uuid::uuid5();

//converting
Uuid::str2uuid($hexString);
Uuid::uuid2str($binary);

```

To use the rest ActiveControllers use the provided ActiveController instead of yii\\rest\\ActiveController

```
use wartron\yii2uuid\rest\ActiveController;

```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/f027070b85d57266fc0893ac4f47f87ce7a7ff0160349247f17d455bf49bb2d5?d=identicon)[wartron](/maintainers/wartron)

---

Top Contributors

[![wartron](https://avatars.githubusercontent.com/u/713638?v=4)](https://github.com/wartron "wartron (22 commits)")

### Embed Badge

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

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

###  Alternatives

[liyunfang/yii2-contextmenu

yii2 Extended for bootstrap-contextmenu plugin https://github.com/sydcanem/bootstrap-contextmenu

2432.4k1](/packages/liyunfang-yii2-contextmenu)[danielgsims/staticproxy

A thin proxy for static classes

118.2k](/packages/danielgsims-staticproxy)[fogs/tagging-bundle

Tag any entity in your Symfony2 project.

113.5k](/packages/fogs-tagging-bundle)[arg/tagcloud

PHP Tag Cloud composer package Implementation of http://lotsofcode.github.io/tag-cloud/

101.9k2](/packages/arg-tagcloud)

PHPackages © 2026

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