PHPackages                             lku/doctrine-guid - 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. lku/doctrine-guid

Abandoned → [ramsey/uuid-doctrine](/?search=ramsey%2Fuuid-doctrine)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

lku/doctrine-guid
=================

Doctrine Event Subscriber for automatic generation GUID/UUID

1.0.3(10y ago)842.8k↓50%2MITPHPPHP ^5.4 || ^7.0

Since Jan 3Pushed 8y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (5)Used By (0)

Doctrine GUID Event Subscriber
==============================

[](#doctrine-guid-event-subscriber)

[![Build Status](https://camo.githubusercontent.com/5edbd7c9fd9a56e1c45bc440a7ade73c1fd78ebc58347a48e9248bc14c01a251/68747470733a2f2f7472617669732d63692e6f72672f6c6b752f646f637472696e652d677569642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lku/doctrine-guid)[![Code Coverage](https://camo.githubusercontent.com/c02c6a9a754e796ea652e014c17029961d080c54a1afff0173c04b82ca612b8b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c6b752f646f637472696e652d677569642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lku/doctrine-guid/?branch=master)[![Dependency Status](https://camo.githubusercontent.com/8135fb1347aacb24d273cfab92702427148736a2f169835b90d4fe2d9eae036a/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6c6b753a646f637472696e652d677569642f62616467652e737667)](https://www.versioneye.com/php/lku:doctrine-guid)

This library provides [event subscriber](http://docs.doctrine-project.org/en/latest/reference/events.html)for [Doctrine ORM](http://www.doctrine-project.org/projects/orm.html), which generates [GUID](http://en.wikipedia.org/wiki/Globally_unique_identifier) in `prePersist` event automatically for every entity field with [guid](http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#doctrine-mapping-types) type.

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

[](#installation)

```
composer require lku/doctrine-guid
```

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

[](#requirements)

- PHP 5.4+
- Doctrine ORM 2.4+

Usage
-----

[](#usage)

#### Register event subscriber:

[](#register-event-subscriber)

```
$guidGenerator = new Doctrine\ORM\Id\UuidGenerator();
$subscriber = new LKu\DoctrineGuid\EventSubscriber($guidGenerator);

$entityManager->getEventManager()->addEventSubscriber($subscriber);
```

#### Add GUID field definition to entity:

[](#add-guid-field-definition-to-entity)

```
/**
 * @ORM\Entity
 **/
class Entity
{
    /**
     * @ORM\Column(type="guid")
     **/
    protected $guid;
}
```

After persisting new instance of `Entity` class in `EntityManager` it has `guid` field filled with GUID.

License
-------

[](#license)

This library is released under the MIT License.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~114 days

Total

4

Last Release

3811d ago

PHP version history (3 changes)1.0.0PHP ~5.4

1.0.2PHP &gt;=5.4.0

1.0.3PHP ^5.4 || ^7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/467afb9cbc8592489fbaa0c1684e139a4096837430181fe06b7572837c60dd8d?d=identicon)[lku](/maintainers/lku)

---

Top Contributors

[![lku](https://avatars.githubusercontent.com/u/702420?v=4)](https://github.com/lku "lku (8 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lku-doctrine-guid/health.svg)

```
[![Health](https://phpackages.com/badges/lku-doctrine-guid/health.svg)](https://phpackages.com/packages/lku-doctrine-guid)
```

###  Alternatives

[shlinkio/shlink

A self-hosted and PHP-based URL shortener application with CLI and REST interfaces

4.8k4.3k](/packages/shlinkio-shlink)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[hostnet/entity-tracker-component

Provides an event when a Tracked entity changes

16158.1k4](/packages/hostnet-entity-tracker-component)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)[kibatic/datagrid-bundle

Datagrid for Symfony

1418.3k](/packages/kibatic-datagrid-bundle)

PHPackages © 2026

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