PHPackages                             mapado/mysql-doctrine-functions - 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. mapado/mysql-doctrine-functions

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

mapado/mysql-doctrine-functions
===============================

MySQL Function for Doctrine : RAND(), ROUND() DATE(), DATE\_FORMAT()...

v1.1.3(10y ago)44271.5k↓36%5[1 issues](https://github.com/mapado/MysqlDoctrineFunctions/issues)1MITPHP

Since Mar 1Pushed 2y ago13 watchersCompare

[ Source](https://github.com/mapado/MysqlDoctrineFunctions)[ Packagist](https://packagist.org/packages/mapado/mysql-doctrine-functions)[ RSS](/packages/mapado-mysql-doctrine-functions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (8)Used By (1)

MySQL Doctrine functions
========================

[](#mysql-doctrine-functions)

This library provides you MySQL functions for Doctrine2.

At the moment are supported

- RAND
- ROUND
- DATE
- DATE\_FORMAT

Feel free to fork and add other functions.

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

[](#installation)

### Get the package

[](#get-the-package)

With [composer](https://getcomposer.org/)

```
composer require mapado/mysql-doctrine-functions
```

### Add the classes to your configuration

[](#add-the-classes-to-your-configuration)

```
$config = new \Doctrine\ORM\Configuration();
$config->addCustomStringFunction('rand', \Mapado\MysqlDoctrineFunctions\DQL\MysqlRand::class);
$config->addCustomStringFunction('round', \Mapado\MysqlDoctrineFunctions\DQL\MysqlRound::class);
$config->addCustomStringFunction('date', \Mapado\MysqlDoctrineFunctions\DQL\MysqlDate::class);
$config->addCustomStringFunction('date_format', \Mapado\MysqlDoctrineFunctions\DQL\MysqlDateFormat::class);

$em = EntityManager::create($dbParams, $config);
```

You can of course pick just the functions you need.

### Use with Symfony

[](#use-with-symfony)

If you install the library in a Symfony application, you can add this in your `config.yml` file (`doctrine.yaml` file if you use symfony flex)

```
# app/config/config.yml
doctrine:
    orm:
        # ...
        entity_managers:
            default:
                # ...
                dql:
                    numeric_functions:
                        rand:        'Mapado\MysqlDoctrineFunctions\DQL\MysqlRand'
                        round:       'Mapado\MysqlDoctrineFunctions\DQL\MysqlRound'
                    datetime_functions:
                        date:        'Mapado\MysqlDoctrineFunctions\DQL\MysqlDate'
                        date_format: 'Mapado\MysqlDoctrineFunctions\DQL\MysqlDateFormat'
                    # ... add all functions you need
```

### Usage

[](#usage)

You can now use the functions in your DQL Query

```
$query = 'SELECT RAND(), ROUND(123.45)
        FROM ...
    ';
$em->createQuery($query);
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity44

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 65.2% 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 ~149 days

Recently: every ~171 days

Total

7

Last Release

3930d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3277986d0e1f93c7e8a58fdaf1b52e3f5a1588e73dfa298d33aafb1ebbde5ef2?d=identicon)[jdeniau](/maintainers/jdeniau)

![](https://www.gravatar.com/avatar/90d135128b469dc38fcf186ac78d0f2cd82fc696ffcf5be8a8c486b7bd911ff6?d=identicon)[mapado](/maintainers/mapado)

---

Top Contributors

[![jdeniau](https://avatars.githubusercontent.com/u/1398469?v=4)](https://github.com/jdeniau "jdeniau (15 commits)")[![hpatoio](https://avatars.githubusercontent.com/u/249948?v=4)](https://github.com/hpatoio "hpatoio (3 commits)")[![RooTooZ](https://avatars.githubusercontent.com/u/3372676?v=4)](https://github.com/RooTooZ "RooTooZ (2 commits)")[![apfelbox](https://avatars.githubusercontent.com/u/1032411?v=4)](https://github.com/apfelbox "apfelbox (1 commits)")[![hermannomni](https://avatars.githubusercontent.com/u/5928928?v=4)](https://github.com/hermannomni "hermannomni (1 commits)")[![stevetauber](https://avatars.githubusercontent.com/u/1258342?v=4)](https://github.com/stevetauber "stevetauber (1 commits)")

---

Tags

doctrinemysqlmysql-functionsphpmysqldoctrinefunctionmapado

### Embed Badge

![Health badge](/badges/mapado-mysql-doctrine-functions/health.svg)

```
[![Health](https://phpackages.com/badges/mapado-mysql-doctrine-functions/health.svg)](https://phpackages.com/packages/mapado-mysql-doctrine-functions)
```

###  Alternatives

[oro/doctrine-extensions

Doctrine Extensions for MySQL and PostgreSQL.

34411.8M19](/packages/oro-doctrine-extensions)[scienta/doctrine-json-functions

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

58723.9M36](/packages/scienta-doctrine-json-functions)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[fza/mysql-doctrine-levenshtein-function

Provides the `LEVENSHTEIN()` and `LEVENSHTEIN\_RATIO()` MySQL functions for Doctrine2.

47115.8k1](/packages/fza-mysql-doctrine-levenshtein-function)[okapon/doctrine-set-type-bundle

Provides support of MySQL SET type for Doctrine2 in Symfony2 applications.

11159.0k](/packages/okapon-doctrine-set-type-bundle)

PHPackages © 2026

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