PHPackages                             graefe/doctrine-extensions - 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. graefe/doctrine-extensions

ActiveLibrary

graefe/doctrine-extensions
==========================

Collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

v0.3.0(9y ago)0126MITPHPPHP &gt;=5.6.0

Since Mar 1Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/cgraefe/doctrine-extensions)[ Packagist](https://packagist.org/packages/graefe/doctrine-extensions)[ RSS](/packages/graefe-doctrine-extensions/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Doctrine-Extensions
===================

[](#doctrine-extensions)

[![Build Status](https://camo.githubusercontent.com/db596734b19c3cad5a6c3e4c6eb7665533b82f33b566b3104a6632bb138bf1a2/68747470733a2f2f7472617669732d63692e6f72672f636772616566652f646f637472696e652d657874656e73696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/cgraefe/doctrine-extensions)

This is a collection of useful types and other minor extensions to the Doctrine DBAL and ORM.

UnixTimeType
------------

[](#unixtimetype)

UnixTimeType is a custom Doctrine mapping type for time-stamp values represented in unix time, i.e. seconds since Jan 1, 1970.

```
// Register custom type during boot-strap.
\Doctrine\DBAL\Types\Type::addType('unixtime', '\Graefe\Doctrine\Type\UnixTimeType');

...

/**
 * @ORM\Column(name="created", type="unixtime", nullable=false)
 */
private $created;
```

MySqlEnumType
-------------

[](#mysqlenumtype)

MySqlEnumType is an abstract base class for mapping ENUM types in MySQL.

```
// Define type.
class ShopModeType extends \Graefe\Doctrine\Type\MySqlEnumType
{
    protected function getValues() { return array('b2b','b2c'); }
    public function getName() { return 'shopmode'; }
}

...

// Register type during boot-strap.
\Doctrine\DBAL\Types\Type::addType('shopmode', 'ShopModeType');

...

/**
 * @ORM\Column(name="mode", type="shopmode", nullable=false)
 */
private $mode;
```

RAND()
------

[](#rand)

The Rand class provides the RAND() function to DQL for selecting random rows. (Caveat: Improper use might cause serious performance problems.)

```
// Register function.
$em->getConfiguration()->addCustomNumericFunction('RAND', '\\Graefe\\Doctrine\\Functions\\Rand');

...

$qb->select('d')
    ->addSelect('RAND() AS randval')
    ->from('Dummy', 'd')
    ->orderBy('randval')
    ->setMaxResults(1);
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance54

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Total

4

Last Release

3640d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0a369b471e6a87bc04b5ef63b19605d80ec02bc30fba34eea827989b776a3aa?d=identicon)[cgraefe](/maintainers/cgraefe)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/graefe-doctrine-extensions/health.svg)

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

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M36](/packages/scienta-doctrine-json-functions)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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