PHPackages                             ramsey/uuid-doctrine - 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. ramsey/uuid-doctrine

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

ramsey/uuid-doctrine
====================

Use ramsey/uuid as a Doctrine field type.

2.1.0(1y ago)90440.3M↑12.5%80[8 issues](https://github.com/ramsey/uuid-doctrine/issues)[3 PRs](https://github.com/ramsey/uuid-doctrine/pulls)20MITPHPPHP ^8.1

Since Sep 28Pushed 1y ago15 watchersCompare

[ Source](https://github.com/ramsey/uuid-doctrine)[ Packagist](https://packagist.org/packages/ramsey/uuid-doctrine)[ GitHub Sponsors](https://github.com/ramsey)[ Fund](https://tidelift.com/funding/github/packagist/ramsey/uuid-doctrine)[ RSS](/packages/ramsey-uuid-doctrine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (16)Versions (19)Used By (20)

ramsey/uuid-doctrine
====================

[](#ramseyuuid-doctrine)

 **Use [ramsey/uuid](https://github.com/ramsey/uuid) as a [Doctrine field type](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html)**

 [![Source Code](https://camo.githubusercontent.com/e60f26025cc25ea13f69e748eb9aa57769393186c9c6a587817a3aec7f71b90b/687474703a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d72616d7365792f757569642d2d646f637472696e652d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/ramsey/uuid-doctrine) [![Download Package](https://camo.githubusercontent.com/f83fe998d66c57d386cb7e9e335a4a50bdd144eb4d6818a2056bb95c9b16b93b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72616d7365792f757569642d646f637472696e652e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/ramsey/uuid-doctrine) [![PHP Programming Language](https://camo.githubusercontent.com/321b0b90d10954283dcbe23f554d83159d7558903d56c0d7630cf4d9add208b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f72616d7365792f757569642d646f637472696e652e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d253233383839324246)](https://php.net) [![Read License](https://camo.githubusercontent.com/360cb49416ea8ba9ea0884014fe6c6f57822a32fb20cef4fe76a5f43d2784603/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72616d7365792f757569642d646f637472696e652e7376673f7374796c653d666c61742d73717561726526636f6c6f72423d6461726b6379616e)](https://github.com/ramsey/uuid-doctrine/blob/main/LICENSE) [![Build Status](https://camo.githubusercontent.com/b254644973af90046e56db14d5a81bd9ca56a9ec598674134268a8bc1a4d834d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72616d7365792f757569642d646f637472696e652f636f6e74696e756f75732d696e746567726174696f6e2e796d6c3f6272616e63683d6d61696e266c6f676f3d676974687562267374796c653d666c61742d737175617265)](https://github.com/ramsey/uuid-doctrine/actions/workflows/continuous-integration.yml) [![Codecov Code Coverage](https://camo.githubusercontent.com/88f7852fee6068e30829f5cd3ea5fce5becd901dd8520ee9e102ae64209481c6/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f72616d7365792f757569642d646f637472696e653f6c6162656c3d636f6465636f76266c6f676f3d636f6465636f76267374796c653d666c61742d737175617265)](https://codecov.io/gh/ramsey/uuid-doctrine)

The ramsey/uuid-doctrine package provides the ability to use [ramsey/uuid](https://github.com/ramsey/uuid) as a [Doctrine field type](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html).

This project adheres to a [code of conduct](CODE_OF_CONDUCT.md). By participating in this project and its community, you are expected to uphold this code.

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

[](#installation)

Install this package as a dependency using [Composer](https://getcomposer.org).

```
composer require ramsey/uuid-doctrine
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

To configure Doctrine to use ramsey/uuid as a field type, you'll need to set up the following in your bootstrap:

```
\Doctrine\DBAL\Types\Type::addType('uuid', 'Ramsey\Uuid\Doctrine\UuidType');
```

In Symfony:

```
# config/packages/doctrine.yaml
doctrine:
    dbal:
        types:
            uuid: Ramsey\Uuid\Doctrine\UuidType
```

In Zend Framework:

```
