PHPackages                             mihai-stancu/doctrine-types-extra - 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. mihai-stancu/doctrine-types-extra

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

mihai-stancu/doctrine-types-extra
=================================

Doctrine2 storing `UUID()` as BINARY(16) and `UUID\_SHORT()` as BIGINT for MySQL.

31.8k2PHPCI failing

Since Aug 2Pushed 9y ago2 watchersCompare

[ Source](https://github.com/mihai-stancu/doctrine-types-extra)[ Packagist](https://packagist.org/packages/mihai-stancu/doctrine-types-extra)[ RSS](/packages/mihai-stancu-doctrine-types-extra/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Doctrine2 extra types
=====================

[](#doctrine2-extra-types)

Doctrine2's default GUID works as a native data type for platforms that support it (Oracle, MSSQL, PostgreSQL) but falls back to VARCHAR in others (MySQL, SQLite).

- BINARY: `binary_guid` is an alternative of the default `guid` type which uses BINARY(16) on all platforms (or VARBINARY(16) on platforms without fixed length binary). The default GeneratedValue (`UUID`) is used as the generator function and `hex2bin` / `bin2hex` converters are used. `BinaryGuidType` extends `BinaryType`.
- SHORT: `short_guid` is an extension of the default `guid` type which uses BIGINT as a fallback type for UUIDs in MySQL instead of VARCHAR. The `UUID_SHORT()` function from MySQL is used as the generator function and the results are handled as integers. `ShortGuidType` extends `GuidType`.

**N.B.: !!! MySQl's short UUIDs are not standard UUIDs and they are not guaranteed to be unique across (...more than 256...) servers.**

Sets and enums are not supported in Doctrine2 by default but they can be treated as strings in most scenarios.

- SET: `set` is a naive implementation of MySQL's `set` data type represented in PHP as an array of strings. The type only supports generating create statements and implode / explode converters. `SetType` extends `SimpleArrayType`.

---

Usage
-----

[](#usage)

Adding the following lines in your `app/config.yml` (for Symfony2 projects) should do the trick:

```
doctrine:
    dbal:
        types:
            binary_guid: MS\DoctrineTypes\DBAL\Types\BinaryGuidType
            short_guid: MS\DoctrineTypes\DBAL\Types\ShortGuidType

            set: MS\DoctrineTypes\DBAL\Types\SetType

        mapping_types:
            binary_guid: binary_guid
            short_guid: short_guid

            set: set

```

And adding the following Annotation comments in your entity definitions should finish the job:

```
    /**
     * @Id
     * @Column(type="binary_guid")
     * @GeneratedValue(strategy="UUID")
     */

```

or

```
    /**
     * @Id
     * @Column(type="short_guid")
     * @GeneratedValue(strategy="CUSTOM")
     * @CustomIdGenerator(class="MS\DoctrineTypes\ORM\Id\ShortGuidGenerator")
     */

```

or

```
    /**
     * @Column(type="set", options={ "values"={"value1", "value2"} })
     */

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/60ee24787511ba533b00897d359773c394bc11987dc75a6b15a75924a35ba61d?d=identicon)[mihai-stancu](/maintainers/mihai-stancu)

---

Top Contributors

[![mihai-stancu](https://avatars.githubusercontent.com/u/1294142?v=4)](https://github.com/mihai-stancu "mihai-stancu (16 commits)")

### Embed Badge

![Health badge](/badges/mihai-stancu-doctrine-types-extra/health.svg)

```
[![Health](https://phpackages.com/badges/mihai-stancu-doctrine-types-extra/health.svg)](https://phpackages.com/packages/mihai-stancu-doctrine-types-extra)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

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