PHPackages                             kherge/uuid-bundle - 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. kherge/uuid-bundle

Abandoned → [mcfedr/uuid-extra-bundle](/?search=mcfedr%2Fuuid-extra-bundle)ArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

kherge/uuid-bundle
==================

Integrates the UUID library with Symfony 2.

2.0.0(9y ago)256.5k[2 issues](https://github.com/kherge-archive/uuid-bundle/issues)MITPHPPHP &gt;=5.6

Since Mar 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/kherge-archive/uuid-bundle)[ Packagist](https://packagist.org/packages/kherge/uuid-bundle)[ RSS](/packages/kherge-uuid-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (12)Versions (4)Used By (0)

[![Build Status](https://camo.githubusercontent.com/726990ab985eb23b058c0bec8ff610a8ca3c09c966025a7424aed2b1dc4ec9d8/68747470733a2f2f7472617669732d63692e6f72672f6b68657267652d7068702f757569642d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kherge-php/uuid-bundle)[![Packagist](https://camo.githubusercontent.com/04db7f1476c9c65e339c1c637196c647626c10af58cf74a83e0d808ba5368f11/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b68657267652f757569642d62756e646c652e737667)](https://packagist.org/packages/kherge/uuid-bundle)[![Packagist Pre Release](https://camo.githubusercontent.com/64f66686f4e1bcf7d11cf12e74713bfd43b44dcb8a98172ee31eaa9937a574fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6b68657267652f757569642d62756e646c652e737667)](https://packagist.org/packages/kherge/uuid-bundle)

UUID Bundle
===========

[](#uuid-bundle)

This bundle integrates [`ramsey/uuid`](https://github.com/ramsey/uuid) into Symfony 2 as services.

Usage
-----

[](#usage)

```
use Ramsey\Uuid\Uuid;

// The UUID factory is available as a service.
$factory = $this->container->get('kherge_uuid.uuid_factory');

// And you can use it how you normally would.
$v1 = $factory->uuid1();
$v3 = $factory->uuid3(Uuid::NAMESPACE_DNS, 'example.com');
$v4 = $factory->uuid4();
$v5 = $factory->uuid5(Uuid::NAMESPACE_DNS, 'example.com');
```

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

[](#installation)

```
composer require kherge/uuid-bundle

```

Once Composer has downloaded the bundle and its dependencies, please add the following line to where you believe it is appropriate in the `AppKernel` class (or your app's equivalent).

```
new KHerGe\Bundle\UuidBundle\KHerGeUuidBundle(),

```

Configuration
-------------

[](#configuration)

While no configuration is required, you may want to refer to the output of `app/console config:dump-reference kherge_uuid` to see a breakdown of all available settings. Each setting is documented so that choosing the right settings becomes a little simpler. You will be expected to know how to use the `ramsey/uuid` package to understand how the bundle's settings will work with its classes.

### Recommended Settings

[](#recommended-settings)

This will allow you to generate secure UUIDs, but requires that you have the `moontoast/math` package and `libsodium` extension installed.

```
kherge_uuid:
    builder:
        default:
            number_converter: kherge_uuid.number_converter.big_number
    generator:
        default_time:
            time_converter: kherge_uuid.time_converter.big_number
    uuid_factory:
        number_converter: kherge_uuid.number_converter.big_number
        random_generator: kherge_uuid.generator.sodium
        time_generator: kherge_uuid.generator.default_time
```

> You may want to change the random generator.

### Doctrine

[](#doctrine)

You can have Doctrine automatically generate new UUIDs for your new entities. Support is limited to only v1 and v4 UUIDs. To use the custom generators, you will need to use the following annotations for the ID field in your entity:

```
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity()
 * @ORM\Table()
 */
class Entity
{
    /**
     * @ORM\Column(type="uuid")
     * @ORM\CustomIdGenerator("KHerGe\Bundle\UuidBundle\Doctrine\Id\Uuid4Generator")
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\Id()
     */
    private $id;
}
```

> Replace the class name with the desired generator.

It is strongly recommended that you enable the use of a global factory. Not doing so will allow the UUID library to create and use its own UUID factory, independent of the factory service that was configured for Symfony.

```
kherge_uuid:
    uuid_factory:
        global: true
```

### Parameter Conversion

[](#parameter-conversion)

The bundle provides support for converting UUIDs in request parameters. To use this feature, you must have the `sensio/framework-extra-bundle` installed to support parameter conversion.

```
use Ramsey\Uuid\Uuid;

/**
 * @Route("/entity/{id}")
 * @ParamConverter("id")
 */
public function getAction(Uuid $id)
{
    // ... use the uuid ...
}
```

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~155 days

Total

3

Last Release

3449d ago

Major Versions

1.x-dev → 2.0.02017-01-19

PHP version history (2 changes)1.0.0PHP &gt;=5.4

2.0.0PHP &gt;=5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/9122157?v=4)[Kevin Herrera](/maintainers/kherge)[@kherge](https://github.com/kherge)

---

Top Contributors

[![kherge](https://avatars.githubusercontent.com/u/9122157?v=4)](https://github.com/kherge "kherge (52 commits)")[![kherrera-ebsco](https://avatars.githubusercontent.com/u/25376904?v=4)](https://github.com/kherrera-ebsco "kherrera-ebsco (1 commits)")

---

Tags

uuidsymfonybundleuuid

### Embed Badge

![Health badge](/badges/kherge-uuid-bundle/health.svg)

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

PHPackages © 2026

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