PHPackages                             beberlei/doctrineextensions - 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. beberlei/doctrineextensions

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

beberlei/doctrineextensions
===========================

A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.

v1.5.0(2y ago)2.1k75.1M—3.5%422[45 PRs](https://github.com/beberlei/DoctrineExtensions/pulls)20BSD-3-ClausePHPPHP ^7.2 || ^8.0

Since May 16Pushed 1y ago53 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (52)Used By (20)

DoctrineExtensions
==================

[](#doctrineextensions)

[![Build Status](https://camo.githubusercontent.com/3fa4dd6b22d6ba39b4a6124ce262c7035f01b66bbcdce677bdbdb53665592249/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6272616e63682d6d61737465722d626c75652e737667)](https://github.com/beberlei/DoctrineExtensions/tree/master)[![Build Status](https://github.com/beberlei/DoctrineExtensions/workflows/Tests/badge.svg)](https://github.com/beberlei/DoctrineExtensions/actions)[![Packagist](https://camo.githubusercontent.com/e2c8166f33800306023c44fdf7eb0c8b6ae1663c8a3cb801c13a02a504c4d7a2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62656265726c65692f646f637472696e65657874656e73696f6e732e7376673f6c6162656c3d737461626c65)](https://packagist.org/packages/beberlei/doctrineextensions)[![Packagist](https://camo.githubusercontent.com/57f03bd7af2700b774fe8a938885691b127bb6c6449ac50c3cda20759364edc5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f62656265726c65692f646f637472696e65657874656e73696f6e732e7376673f6c6162656c3d254532254143253837)](https://packagist.org/packages/beberlei/doctrineextensions)[![Packagist](https://camo.githubusercontent.com/6218567e8b234f3c30a11f2281adbd7638146d9c46c914c2a02009c7b7d2a977/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f62656265726c65692f646f637472696e65657874656e73696f6e732e7376673f6c6162656c3d254532254143253837)](https://packagist.org/packages/beberlei/doctrineextensions)[![Packagist](https://camo.githubusercontent.com/af5f7db023c14bfb39b9be59ec0c03bf4bc99d27b43e2a7eb9bef1cbdb68ed4f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f62656265726c65692f646f637472696e65657874656e73696f6e732e7376673f6c6162656c3d254532254143253837)](https://packagist.org/packages/beberlei/doctrineextensions)

A set of extensions to Doctrine 2 that add support for functions available in MySQL, Oracle, PostgreSQL and SQLite.

DBFunctionsMySQL`ACOS, ADDTIME, AES_DECRYPT, AES_ENCRYPT, ANY_VALUE, ASCII, ASIN, ATAN, ATAN2, BINARY, BIT_COUNT, BIT_XOR, CAST, CEIL, CHAR_LENGTH, COLLATE, CONCAT_WS, CONVERT_TZ, COS, COT, COUNTIF, CRC32, DATE, DATE_FORMAT, DATEADD, DATEDIFF, DATESUB, DAY, DAYNAME, DAYOFWEEK, DAYOFYEAR, DEGREES, DIV, EXP, EXTRACT, FIELD, FIND_IN_SET, FLOOR, FORMAT, FROM_BASE64, FROM_UNIXTIME, GREATEST, GROUP_CONCAT, HEX, HOUR, IFELSE, IFNULL, INET_ATON, INET_NTOA, INET6_ATON, INET6_NTOA, INSTR, IS_IPV4, IS_IPV4_COMPAT, IS_IPV4_MAPPED, IS_IPV6, JSON_CONTAINS, JSON_DEPTH, JSON_LENGTH, LAG, LAST_DAY, LEAD, LEAST, LOG, LOG10, LOG2, LPAD, MAKEDATE, MATCH, MD5, MINUTE, MONTH, MONTHNAME, NOW, NULLIF, OVER, PERIOD_DIFF, PI, POWER, QUARTER, RADIANS, RAND, REGEXP, REPLACE, ROUND, RPAD, SECOND, SECTOTIME, SHA1, SHA2, SIN, SOUNDEX, STD, STDDEV, STRTODATE, STR_TO_DATE, SUBSTRING_INDEX, TAN, TIME, TIMEDIFF, TIMESTAMPADD, TIMESTAMPDIFF, TIMETOSEC, TRUNCATE, UNHEX, UNIX_TIMESTAMP, UTC_TIMESTAMP, UUID_SHORT, VARIANCE, WEEK, WEEKDAY, WEEKOFYEAR, YEAR, YEARMONTH, YEARWEEK`Oracle`CEIL, DAY, FLOOR, HOUR, LISTAGG, MINUTE, MONTH, NVL, SECOND, TO_CHAR, TO_DATE, TRUNC, YEAR`SQLite`CASE WHEN THEN ELSE END, DATE, DATE_FORMAT*, DAY, HOUR, IFNULL, JULIANDAY, MINUTE, MONTH, REPLACE, ROUND, SECOND, STRFTIME, WEEK, WEEKDAY, YEAR`PostgreSQL`AT_TIME_ZONE, COUNT_FILTER, DATE, DATE_PART, DATE_TRUNC, DAY, EXTRACT, GREATEST, HOUR, LEAST, MINUTE, MONTH, REGEXP_REPLACE, SECOND, STRING_AGG, TO_CHAR, TO_DATE, YEAR`> Note: SQLite date functions are implemented as `strftime(format, value)`. SQLite only supports the [most common formats](https://www.sqlite.org/lang_datefunc.html), so `date_format` will convert the mysql substitutions to the closest available SQLite substitutions. This means `date_format(field, '%b %D %Y') -> Jan 1st 2015` becomes `strftime('%m %d %Y', field) -> 01 01 2015`.

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

[](#installation)

To install this library, run the command below and you will get the latest version:

```
composer require beberlei/doctrineextensions

```

If you want to run phpunit:

```
composer run test

```

If you want to run php-cs-fixer:

```
composer run lint
```

Usage
-----

[](#usage)

### Symfony

[](#symfony)

If you are using DoctrineExtensions with Symfony read [How to Register custom DQL Functions](https://symfony.com/doc/current/doctrine/custom_dql_functions.html).

You can find example Symfony configuration for using DoctrineExtensions custom DQL functions in [config](config).

### Standalone

[](#standalone)

If you are using DoctrineExtensions standalone, you need to register the custom function in the ORM configuration. For more information check out the documentation of [Doctrine DQL User Defined Functions](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html).

Notes
-----

[](#notes)

- MySQL `DATE_ADD` is available in DQL as `DATEADD(CURRENT_DATE(), 1, 'DAY')`
- MySQL `DATE_SUB` is available in DQL as `DATESUB(CURRENT_DATE(), 1, 'DAY')`
- MySQL `IF` is available in DQL as `IFELSE(field > 0, 'true', 'false')`

Troubleshooting
---------------

[](#troubleshooting)

Issues are disabled on this repository, if a custom DQL function that you want isn't provided, or does not support the arguments you want to pass, pull requests are open and we would love to have your contributions.

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity80

Widely adopted with strong download metrics

Community53

Growing community involvement

Maturity81

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~312 days

Total

51

Last Release

806d ago

Major Versions

v0.3.0 → v1.0.02015-03-15

PHP version history (4 changes)v0.3.0PHP &gt;=5.3.2

v1.0.24PHP &gt;=5.4

v1.2.0PHP ^7.1

v1.3.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/892698bb1d3f6dae0e3a44abe3e26920ddb4eb000c6c583c87b4db5e5027e166?d=identicon)[beberlei](/maintainers/beberlei)

---

Top Contributors

[![stevelacey](https://avatars.githubusercontent.com/u/289531?v=4)](https://github.com/stevelacey "stevelacey (190 commits)")[![beberlei](https://avatars.githubusercontent.com/u/26936?v=4)](https://github.com/beberlei "beberlei (75 commits)")[![MitMaro](https://avatars.githubusercontent.com/u/177427?v=4)](https://github.com/MitMaro "MitMaro (29 commits)")[![nimasdj](https://avatars.githubusercontent.com/u/6756021?v=4)](https://github.com/nimasdj "nimasdj (22 commits)")[![tarjei](https://avatars.githubusercontent.com/u/211263?v=4)](https://github.com/tarjei "tarjei (13 commits)")[![connorhu](https://avatars.githubusercontent.com/u/1845575?v=4)](https://github.com/connorhu "connorhu (11 commits)")[![derrabus](https://avatars.githubusercontent.com/u/1506493?v=4)](https://github.com/derrabus "derrabus (11 commits)")[![FlashBlack](https://avatars.githubusercontent.com/u/915531?v=4)](https://github.com/FlashBlack "FlashBlack (10 commits)")[![barryo](https://avatars.githubusercontent.com/u/804649?v=4)](https://github.com/barryo "barryo (9 commits)")[![fhriz](https://avatars.githubusercontent.com/u/3477490?v=4)](https://github.com/fhriz "fhriz (7 commits)")[![sandermarechal](https://avatars.githubusercontent.com/u/145240?v=4)](https://github.com/sandermarechal "sandermarechal (6 commits)")[![webcraft](https://avatars.githubusercontent.com/u/56675?v=4)](https://github.com/webcraft "webcraft (5 commits)")[![eigan](https://avatars.githubusercontent.com/u/41789?v=4)](https://github.com/eigan "eigan (5 commits)")[![gallien](https://avatars.githubusercontent.com/u/812394?v=4)](https://github.com/gallien "gallien (5 commits)")[![guilhermeblanco](https://avatars.githubusercontent.com/u/208883?v=4)](https://github.com/guilhermeblanco "guilhermeblanco (5 commits)")[![maikelohcfg](https://avatars.githubusercontent.com/u/939605?v=4)](https://github.com/maikelohcfg "maikelohcfg (5 commits)")[![silvioq](https://avatars.githubusercontent.com/u/155036?v=4)](https://github.com/silvioq "silvioq (4 commits)")[![ponchorage](https://avatars.githubusercontent.com/u/169286?v=4)](https://github.com/ponchorage "ponchorage (4 commits)")[![gws](https://avatars.githubusercontent.com/u/111252?v=4)](https://github.com/gws "gws (3 commits)")[![nnmer](https://avatars.githubusercontent.com/u/1620737?v=4)](https://github.com/nnmer "nnmer (3 commits)")

---

Tags

databaseormdoctrine

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/beberlei-doctrineextensions/health.svg)

```
[![Health](https://phpackages.com/badges/beberlei-doctrineextensions/health.svg)](https://phpackages.com/packages/beberlei-doctrineextensions)
```

###  Alternatives

[scienta/doctrine-json-functions

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

58723.9M36](/packages/scienta-doctrine-json-functions)[nettrine/orm

Doctrine ORM for Nette Framework

581.9M37](/packages/nettrine-orm)[laravel-doctrine/fluent

A fluent PHP mapping driver for Doctrine2.

43430.3k13](/packages/laravel-doctrine-fluent)[goodwix/doctrine-json-odm

JSON Object-Document Mapping bundle for Symfony and Doctrine

2226.0k](/packages/goodwix-doctrine-json-odm)[mediagone/doctrine-specifications

Doctrine implementation of repository Specifications pattern

353.8k3](/packages/mediagone-doctrine-specifications)[andsalves/doctrine-elastic

Elasticsearch Doctrine Adaptation

156.6k](/packages/andsalves-doctrine-elastic)

PHPackages © 2026

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