PHPackages                             tourze/doctrine-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. [Database &amp; ORM](/categories/database)
4. /
5. tourze/doctrine-uuid-bundle

ActiveLibrary[Database &amp; ORM](/categories/database)

tourze/doctrine-uuid-bundle
===========================

Symfony bundle for automatic UUID (v1/v4) assignment in Doctrine entities using PHP 8 attributes

1.0.1(6mo ago)026MITPHPCI passing

Since Mar 25Pushed 4mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (21)Versions (7)Used By (0)

Doctrine UUID Bundle
====================

[](#doctrine-uuid-bundle)

[English](README.md) | [中文](README.zh-CN.md)\[[![Latest Version](https://camo.githubusercontent.com/fd2bde020515179b20ce0de27fce95b022b98edd3de8d2d5dfe54834e6872113/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/fd2bde020515179b20ce0de27fce95b022b98edd3de8d2d5dfe54834e6872113/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![PHP Version](https://camo.githubusercontent.com/beb839d6461e3b37b8170008738a67348a2a9a051ebed0a29a898379c8b2b9b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/beb839d6461e3b37b8170008738a67348a2a9a051ebed0a29a898379c8b2b9b9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![License](https://camo.githubusercontent.com/e502d4fc352ea04564c334b9e8c08711edb9888c8afabdd0009949d30203d821/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/e502d4fc352ea04564c334b9e8c08711edb9888c8afabdd0009949d30203d821/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![Build Status](https://camo.githubusercontent.com/148f00272e733bd9decf05f199f7eb5b2c26ac54a2e0786b651a6501955b3504/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f646f637472696e652d757569642d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/148f00272e733bd9decf05f199f7eb5b2c26ac54a2e0786b651a6501955b3504/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f746f75727a652f646f637472696e652d757569642d62756e646c652f6d61737465722e7376673f7374796c653d666c61742d737175617265)\] () \[[![Quality Score](https://camo.githubusercontent.com/6827519ef4b7232c44699049551185ca1ed69c2fdc046562997eb7df628b00f4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6827519ef4b7232c44699049551185ca1ed69c2fdc046562997eb7df628b00f4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![Total Downloads](https://camo.githubusercontent.com/de42e83f6f4c546de0f751c6a5e5436928c6a08f446cd2eb6e837b904ae7d8ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/de42e83f6f4c546de0f751c6a5e5436928c6a08f446cd2eb6e837b904ae7d8ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] () \[[![Code Coverage](https://camo.githubusercontent.com/6e801482ada21dd0f4ebc3c7a36d49bfa1bbd5afd8f13b012ef96f38f70a7e6a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/6e801482ada21dd0f4ebc3c7a36d49bfa1bbd5afd8f13b012ef96f38f70a7e6a/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f746f75727a652f646f637472696e652d757569642d62756e646c652e7376673f7374796c653d666c61742d737175617265)\] ()

A Symfony bundle for automatic UUID (v1/v4) assignment in Doctrine entities using PHP 8 attributes.

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

[](#installation)

```
composer require tourze/doctrine-uuid-bundle
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Symfony 6.4 or higher

Features
--------

[](#features)

- Automatic UUID v1 and v4 assignment for entity properties
- Zero configuration, works out of the box
- Attribute-driven and easy to use
- Seamless integration with Doctrine event system
- Built-in logging for debugging
- Extensible: custom UUID generation strategies supported
- Nullable UUID fields supported
- Automatic database schema updates
- Compatible with Symfony 6.4+ and Doctrine 2.13+

Quick Start
-----------

[](#quick-start)

Add the `UuidV1Column` or `UuidV4Column` attribute to your entity properties:

```
use Tourze\DoctrineUuidBundle\Attribute\UuidV1Column;
use Tourze\DoctrineUuidBundle\Attribute\UuidV4Column;
use Doctrine\ORM\Mapping as ORM;

#[ORM\Entity]
class YourEntity
{
    #[ORM\Id]
    #[ORM\Column(type: 'uuid')]
    #[UuidV1Column]
    private string $uuidV1;

    #[ORM\Column(type: 'uuid')]
    #[UuidV4Column]
    private ?string $uuidV4 = null;
}
```

UUIDs will be automatically generated when the entity is persisted.

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

[](#configuration)

The bundle works with zero configuration. If you need to customize the behavior, you can:

- Create custom UUID attributes by extending the base attributes
- Override the event listener service to implement custom generation logic
- Configure logging levels in your Symfony configuration

Advanced Usage
--------------

[](#advanced-usage)

You may extend the Attribute or event listener to implement custom UUID generation logic.

Security
--------

[](#security)

- UUID v1 contains MAC address and timestamp information, which may be considered sensitive
- UUID v4 is cryptographically random and doesn't contain identifiable information
- Choose the appropriate UUID version based on your security requirements
- Consider using UUID v4 for public-facing identifiers

Common Issues
-------------

[](#common-issues)

1. **UUID not being generated**: Ensure your entity uses the correct attributes and the bundle is registered in `config/bundles.php`.
2. **Database schema issues**: Run `php bin/console doctrine:schema:update --force` to update your database schema.
3. **Performance considerations**: UUID v1 is time-based and may be more suitable for database indexing than UUID v4.

Documentation
-------------

[](#documentation)

- [API Docs](docs/)
- Most configuration is automatic. For advanced extension, you may customize the event subscriber.

Contributing
------------

[](#contributing)

- Feel free to submit Issues and PRs
- Follow PSR code style
- Please ensure tests pass before submitting PRs
- Fork the repo, create a branch, push and submit a PR

License
-------

[](#license)

- License: MIT
- Author: Tourze

Changelog
---------

[](#changelog)

See [CHANGELOG](CHANGELOG.md)

---

### Workflow Diagram

[](#workflow-diagram)

See `Mermaid.md` for a visual workflow.

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance72

Regular maintenance activity

Popularity6

Limited adoption so far

Community7

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.

###  Release Activity

Cadence

Every ~46 days

Recently: every ~58 days

Total

6

Last Release

180d ago

Major Versions

0.0.4 → 1.0.02025-10-31

### Community

Maintainers

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

---

Top Contributors

[![tourze](https://avatars.githubusercontent.com/u/13899502?v=4)](https://github.com/tourze "tourze (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k16.7M310](/packages/easycorp-easyadmin-bundle)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

7310.3k29](/packages/open-dxp-opendxp)

PHPackages © 2026

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