PHPackages                             devuri/uuid-generator - 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. devuri/uuid-generator

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

devuri/uuid-generator
=====================

A PHP package to generate UUIDs more securely and efficiently

v0.0.1(3y ago)135.5k↓25.9%3MITPHP

Since Mar 4Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (3)

UUIDGenerator
=============

[](#uuidgenerator)

The `UUIDGenerator` class is a secure and efficient way to generate UUIDs (Universally Unique Identifiers) in PHP. It generates UUIDs according to the RFC 4122 standard, which ensures that the UUIDs are unique across time and space.

### Installation

[](#installation)

You can install the `UUIDGenerator` class using Composer. Run the following command in your terminal:

```
composer require devuri/uuid-generator

```

Alternatively, you can manually include the `UUIDGenerator` class in your PHP project.

### Usage

[](#usage)

To use the `UUIDGenerator` class, first import the class using the `use` keyword:

```
use Devuri\UUIDGenerator\UUIDGenerator;
```

Then, create a new instance of the `UUIDGenerator` class:

```
$uuidGenerator = new UUIDGenerator();
```

You can optionally specify the version and variant of the UUID you want to generate. The version determines the layout of the UUID, while the variant determines the encoding of the UUID. The default version is 4 (random), and the default variant is the RFC 4122 variant.

```
$uuidGenerator = new UUIDGenerator(1, 0x80);
```

To generate a new UUID, call the `generateUUID()` method:

```
$uuid = $uuidGenerator->generateUUID();
```

The generateUUID() method returns a string in the following format:

```
xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx
```

Where:

- `**x**` is a hexadecimal digit **(0-9, a-f)**
- `**M**` is the version number **(1-5)**
- **`N`** is the variant number **(8, 9, a, b)**

### Example

[](#example)

Here's an example of how to use the `UUIDGenerator` class to generate a new UUID:

```
    use Devuri\UUIDGenerator\UUIDGenerator;

    $uuidGenerator = new UUIDGenerator();
    $uuid = $uuidGenerator->generateUUID();

    echo $uuid;
```

This code creates a new instance of the `UUIDGenerator` class, generates a new UUID, and then prints the UUID to the screen.

### Security

[](#security)

The `UUIDGenerator` class uses a secure and efficient method to generate UUIDs. It generates random bytes using the `random_bytes()` function, which is a cryptographically secure random number generator. It then sets the version and variant bits according to the RFC 4122 standard.

### License

[](#license)

The `UUIDGenerator` class is open-source software licensed under the MIT License. See the `LICENSE` file for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

1171d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8fd19f958b007ec6588d0a5ca2fe78e107edd652f286b836d36b5d1781d573a5?d=identicon)[devuri](/maintainers/devuri)

---

Top Contributors

[![devuri](https://avatars.githubusercontent.com/u/4777400?v=4)](https://github.com/devuri "devuri (7 commits)")

### Embed Badge

![Health badge](/badges/devuri-uuid-generator/health.svg)

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

PHPackages © 2026

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