PHPackages                             digital-craftsman/ids - 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. digital-craftsman/ids

ActiveSymfony-bundle[Utility &amp; Helpers](/categories/utility)

digital-craftsman/ids
=====================

Working with value objects for ids in Symfony

2.4.0(4mo ago)534.3k—7.1%6[1 PRs](https://github.com/digital-craftsman-de/ids/pulls)3MITPHPPHP 8.4.\*|8.5.\*CI failing

Since May 28Pushed 2mo agoCompare

[ Source](https://github.com/digital-craftsman-de/ids)[ Packagist](https://packagist.org/packages/digital-craftsman/ids)[ RSS](/packages/digital-craftsman-ids/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (10)Versions (50)Used By (3)

Id handling with value objects in Symfony
=========================================

[](#id-handling-with-value-objects-in-symfony)

A Symfony bundle to work with id and id list value objects in Symfony. It includes Symfony normalizers for automatic normalization and denormalization and Doctrine types to store the ids and id lists directly in the database.

As it's a central part of an application, it's tested thoroughly (including mutation testing).

[![Latest Stable Version](https://camo.githubusercontent.com/ba07bd21661fa4f64ffb6366b5d136c41eb3d2cdd1f22cebf8ca5701ab314a18/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f737461626c652d322e342e302d626c7565)](https://packagist.org/packages/digital-craftsman/ids)[![PHP Version Require](https://camo.githubusercontent.com/2f2005e31dc46e3c057be679d712cd9c4486aafcd26810f33ab48992af8d4971/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e34253743382e352d356235643935)](https://packagist.org/packages/digital-craftsman/ids)[![codecov](https://camo.githubusercontent.com/f82c0fa424d01a6e61cb0f4c16e8f22998d98fb341c5766d9140385ca46d1b70/68747470733a2f2f636f6465636f762e696f2f67682f6469676974616c2d6372616674736d616e2d64652f6964732f6272616e63682f6d61696e2f67726170682f62616467652e7376673f746f6b656e3d424c304a4b5a594c4247)](https://codecov.io/gh/digital-craftsman-de/ids)[![Packagist Downloads](https://camo.githubusercontent.com/e889ec27df5b0b49b8e83d7d7463e20a9d25d7a86597b82101d7c817ea12b25d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469676974616c2d6372616674736d616e2f696473)](https://camo.githubusercontent.com/e889ec27df5b0b49b8e83d7d7463e20a9d25d7a86597b82101d7c817ea12b25d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469676974616c2d6372616674736d616e2f696473)[![Packagist License](https://camo.githubusercontent.com/5969a46ede4c80981e22aadd15928dfd2edaa71260f25abf39ce33f771dbacb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6469676974616c2d6372616674736d616e2f696473)](https://camo.githubusercontent.com/5969a46ede4c80981e22aadd15928dfd2edaa71260f25abf39ce33f771dbacb4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6469676974616c2d6372616674736d616e2f696473)

Installation and configuration
------------------------------

[](#installation-and-configuration)

Install package through composer:

```
composer require digital-craftsman/ids
```

It's recommended that you install the [`uuid` PHP extension](https://pecl.php.net/package/uuid) for better performance of id creation and validation. `symfony/polyfill-uuid` is used as a fallback. You can [prevent installing the polyfill](./docs/prevent-polyfill-usage.md) when you've installed the PHP extension.

Working with ids
----------------

[](#working-with-ids)

### Creating a new id

[](#creating-a-new-id)

The bulk of the logic is in the `Id` class. Creating a new id is as simple as creating a new `final readonly class` and extending from it like the following:

```
