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

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

luxifer/doctrine-functions
==========================

Doctrine DQL Functions for Mysql

1.7.1(1y ago)882.5M↓39.9%16[2 issues](https://github.com/luxifer/doctrine-functions/issues)[1 PRs](https://github.com/luxifer/doctrine-functions/pulls)MITPHPPHP &gt;=8.2

Since May 25Pushed 1y ago7 watchersCompare

[ Source](https://github.com/luxifer/doctrine-functions)[ Packagist](https://packagist.org/packages/luxifer/doctrine-functions)[ Docs](http://luxifer.github.io/doctrine-functions/)[ RSS](/packages/luxifer-doctrine-functions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (2)Versions (18)Used By (0)

Doctrine Functions
==================

[](#doctrine-functions)

[![Build Status](https://camo.githubusercontent.com/473cdd4b5e5a925ad457e64d34d7a0938aae942503930da1a24ce081c95a6094/68747470733a2f2f7472617669732d63692e6f72672f6c7578696665722f646f637472696e652d66756e6374696f6e732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/luxifer/doctrine-functions) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/d6842faaacb1443b97b7e8dbf57c0ce54e7700b83987a1fb04716ce42e05057c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c7578696665722f646f637472696e652d66756e6374696f6e732f6261646765732f7175616c6974792d73636f72652e706e673f733d33323430366636633664663433373861326633353262643036323730376433633761303231366561)](https://scrutinizer-ci.com/g/luxifer/doctrine-functions/) [![Code Coverage](https://camo.githubusercontent.com/ad968490afbc9757fb8a7d0da056153f3a59b962ec7898e1900f1a95a94f0594/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c7578696665722f646f637472696e652d66756e6374696f6e732f6261646765732f636f7665726167652e706e673f733d36373031643937346330363265326339386563326135353662613862613464623736363637653638)](https://scrutinizer-ci.com/g/luxifer/doctrine-functions/) [![Latest Stable Version](https://camo.githubusercontent.com/0655ac664726674418adac545156cbe1c49b30f9c81c897bfa6a9aa4c007ebb6/68747470733a2f2f706f7365722e707567782e6f72672f6c7578696665722f646f637472696e652d66756e6374696f6e732f762f737461626c652e706e67)](https://packagist.org/packages/luxifer/doctrine-functions) [![Total Downloads](https://camo.githubusercontent.com/c667cfebb015af86ae46853ee0744579cdc244e11dd6c9c79e51b4b3cee9dc81/68747470733a2f2f706f7365722e707567782e6f72672f6c7578696665722f646f637472696e652d66756e6374696f6e732f646f776e6c6f6164732e706e67)](https://packagist.org/packages/luxifer/doctrine-functions)

This package contains doctrine functions, you can contribute by forking it and propose pull request with your own functions. List of available functions:

- `DATE(expr)`
- `DATEDIFF(expr1, expr2)`
- `DAYOFWEEK(expr)`
- `WEEK(expr)`
- `DAY(expr)`
- `DAYOFMONTH(expr)`
- `DAYOFYEAR(expr)`
- `HOUR(expr)`
- `MINUTE(expr)`
- `MONTH(expr)`
- `QUARTER(expr)`
- `SECOND(expr)`
- `TIME(expr)`
- `YEAR(expr)`
- `CONVERT_TZ(expr, 'from_tz', 'to_tz')` (MySQL)
- `DATE_FORMAT(expr, 'format')` (MySQL)
- `CONCAT_WS(separator, str1, str2, ...)` (MySQL)
- `RAND()` (MySQL)
- `MD5(expr)` (MySQL, Postgres)
- `FROM_UNIXTIME(expr1, expr2)` (MySQL)

Edit this file in your pull request to add your functions to the list.

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

[](#requirements)

This library is expected to work with PHP &gt;= 5.3, but you should consider to upgrade to PHP &gt;= 7.0. To contribute to this library you must have PHP &gt;= 7.0 to run the test suite.

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

[](#installation)

Just add the package to your `composer.json`

```
{
    "require": {
        "luxifer/doctrine-functions": "^1.5"
    }
}
```

Integration
-----------

[](#integration)

### 1) Doctrine Only

[](#1-doctrine-only)

According to the [Doctrine documentation](http://doctrine-orm.readthedocs.org/en/latest/cookbook/dql-user-defined-functions.html "Doctrine documentation") you can register the functions in this package this way.

```
