PHPackages                             gryfoss/doctrine-random-id-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. gryfoss/doctrine-random-id-generator

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

gryfoss/doctrine-random-id-generator
====================================

Generates a random ID instead of using autoincrementation.

v2.0.0(7mo ago)069MITPHPCI passing

Since Oct 9Pushed 7mo agoCompare

[ Source](https://github.com/GryfOSS/doctrine-random-id-generator)[ Packagist](https://packagist.org/packages/gryfoss/doctrine-random-id-generator)[ RSS](/packages/gryfoss-doctrine-random-id-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (4)Used By (0)

RandomIdGenerator
=================

[](#randomidgenerator)

[![Tests](https://github.com/GryfOSS/doctrine-random-id-generator/workflows/Tests/badge.svg)](https://github.com/GryfOSS/doctrine-random-id-generator/actions)[![Coverage](https://camo.githubusercontent.com/32855e94577df9d0a30995653b17d33a5fbfdf644518f96ea0374313397d19b7/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f7665726167652d3130302532352d627269676874677265656e)](https://github.com/GryfOSS/doctrine-random-id-generator/actions)[![PHP](https://camo.githubusercontent.com/344e820b219cee3234648531306104364bd684892ad13c5dc79e66eb82a15b90/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322532422d626c7565)](https://php.net)[![Symfony](https://camo.githubusercontent.com/6f2ea817661a9bf7e31561b8849a33765e4de292ca8456e2fc4bd0d06f9e56a5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f73796d666f6e792d372e302532422d626c61636b)](https://symfony.com)

A robust Doctrine ORM ID generator that creates random unique IDs instead of using auto-incrementation. **v2.0.0** adds string ID support!

✨ Features
----------

[](#-features)

- 🎲 **Random ID Generation**: Generates cryptographically secure random integer and string IDs
- 🆕 **String ID Support** (v2.0.0): Generate random alphanumeric, hexadecimal, or custom character string IDs
- 🔧 **Configurable Options**: Customize ranges, lengths, character sets per entity
- ⚡ **Collision Prevention**: Automatic uniqueness checking with configurable retry attempts
- 🛡️ **Type Safety**: Full PHP 8.2+ type declarations and readonly properties
- 🧪 **100% Test Coverage**: Comprehensive unit and functional test suites
- 🐳 **Docker Ready**: Complete functional testing with Symfony + MariaDB
- 📦 **Symfony Integration**: Proper service container configuration

🚀 Installation
--------------

[](#-installation)

```
composer require gryfoss/doctrine-random-id-generator
```

💡 Usage Examples
----------------

[](#-usage-examples)

### Integer IDs (Existing)

[](#integer-ids-existing)

```
