PHPackages                             nik-zp/doctrine-dbal-postgresql - 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. nik-zp/doctrine-dbal-postgresql

ActiveLibrary

nik-zp/doctrine-dbal-postgresql
===============================

Extensions for support Postgres in Doctrine DBAL &amp; DQL

v1.0.0(3y ago)07MITPHPPHP ^7.4 || ^8.0

Since Apr 5Pushed 3y agoCompare

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

READMEChangelogDependencies (11)Versions (27)Used By (0)

doctrine-dbal-postgresql
========================

[](#doctrine-dbal-postgresql)

[![Latest Stable Version](https://camo.githubusercontent.com/e7bba01532902b28f1ebebb5d754532eb323df375c4cec8b60d51aa982b480dd/68747470733a2f2f706f7365722e707567782e6f72672f6f70737761792f646f637472696e652d6462616c2d706f737467726573716c2f762f737461626c65)](https://packagist.org/packages/opsway/doctrine-dbal-postgresql) [![Total Downloads](https://camo.githubusercontent.com/bb10e65c3fcb26b1e76233d296dcb00f7d33c062a049bda165289fd07aa2d3f5/68747470733a2f2f706f7365722e707567782e6f72672f6f70737761792f646f637472696e652d6462616c2d706f737467726573716c2f646f776e6c6f616473)](https://packagist.org/packages/opsway/doctrine-dbal-postgresql) [![Latest Unstable Version](https://camo.githubusercontent.com/1f0b9b44e864018e07df0ce670b41f8205c526e887c88a484cdbae06b7b9f4b7/68747470733a2f2f706f7365722e707567782e6f72672f6f70737761792f646f637472696e652d6462616c2d706f737467726573716c2f762f756e737461626c65)](https://packagist.org/packages/opsway/doctrine-dbal-postgresql)

This component allows you to manage some native [PostgreSQL](http://www.postgresql.org)data types, operators and functions with the Doctrine [DBAL](http://www.doctrine-project.org/projects/dbal.html) component.

Usage
-----

[](#usage)

Add to composer.json

```
php composer.phar require opsway/doctrine-dbal-postgresql ~0.8
```

To use the new types you should register them using the [Custom Mapping Types](https://doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#custom-mapping-types) feature.

To use the new functions you should register them using the [DQL User Defined Functions](https://www.doctrine-project.org/projects/doctrine-orm/en/latest/cookbook/dql-user-defined-functions.html) feature.

#### Custom Types

[](#custom-types)

- Array Integer (integer\[\])
- Array BigInt (bigint\[\])
- TsVector (tsvector)

#### Custom DQL functions

[](#custom-dql-functions)

- CONTAINS - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\Contains'
- CONTAINED - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\Contained'
- GET\_JSON\_FIELD - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\GetJsonField'
- GET\_JSON\_FIELD\_BY\_KEY - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\GetJsonFieldByKey'
- GET\_JSON\_OBJECT - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\GetJsonObject'
- GET\_JSON\_OBJECT\_TEXT - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\GetJsonObjectText'
- ANY\_OP - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\Any'
- ALL\_OP - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\All'
- ARR - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\Arr'
- ARR\_AGGREGATE - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ArrayAggregate'
- ARR\_APPEND - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ArrayAppend'
- ARR\_REPLACE - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ArrayReplace'
- REGEXP\_REPLACE - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\RegexpReplace'
- ARR\_REMOVE - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ArrayRemove'
- ARR\_CONTAINS - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ArrayContains'
- TO\_TSQUERY - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ToTsquery'
- TO\_TSVECTOR - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\ToTsvector'
- TS\_CONCAT\_OP - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\TsConcat'
- TS\_MATCH\_OP - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\TsMatch'
- UNNEST - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\Unnest'
- JSON\_AGG - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\JsonAgg'
- JSONB\_ARRAY\_ELEM\_TEXT - 'OpsWay\\Doctrine\\ORM\\Query\\AST\\Functions\\JsonbArrayElementsText'

### Custom DQL function usage

[](#custom-dql-function-usage)

For an example the CONTAINS function requires your table column in your database to be of the type `jsonb`. Otherwise PostgreSQL will not recognize the operator needed to perform this action. (@&gt;)

- Tip: Based on the function you want to use, check if there are any specific column type requirements.

Example query:

```
$result = $this->em->createQuery(
    'SELECT l FROM Foo\Bar\Baz l WHERE CONTAINS(l.metaData, :value) = true')
    ->setParameter('value', json_encode(['foo'=>'bar']))
    ->getResult();
```

Setting the column type to `jsonb`.

```
/**
 * @var array
 *
 * @ORM\Column(type="json", nullable=true, options={"jsonb": true})
 */
private $metaData;

```

Custom NamePostgreSqlUsage in DQLResult in SQLCONTAINS@&gt;CONTAINS(field, :param)(field @&gt; '{value}')CONTAINED&lt;@CONTAINED(field, :param)(field &lt;@ '{value}')GET\_JSON\_FIELD-&gt;&gt;GET\_JSON\_FIELD(field, 'json\_field')(table\_field-&gt;&gt;'json\_field')GET\_JSON\_FIELD\_BY\_KEY-&gt;GET\_JSON\_FIELD\_BY\_KEY(field, 'json\_field')(table\_field-&gt;'json\_field')GET\_JSON\_OBJECT\#&gt;GET\_JSON\_OBJECT(field, 'json\_field')(table\_field#&gt;'json\_field')GET\_JSON\_OBJECT\_TEXT\#&gt;&gt;GET\_JSON\_OBJECT\_TEXT(field, 'json\_field')(table\_field#&gt;&gt;'json\_field')ANY\_OPANYANY\_OP(field)ANY(field)ALL\_OPALLALL\_OP(field)ALL(field)ARRARRAYARR(field)ARRAY\[field\]ARR\_AGGREGATEarray\_aggARR\_AGGREGATE(field)array\_agg(field)ARR\_APPENDarray\_appendARR\_APPEND(field, :param)array\_append(field, param)ARR\_REPLACEarray\_replaceARR\_REPLACE(field, :param1, :param2)array\_replace(field, p1, p2)REGEXP\_REPLACEregexp\_replaceREGEXP\_REPLACE(field, :param1, :param2)regexp\_replace(field, p1, p2)ARR\_REMOVEarray\_removeARR\_REMOVE(field, :param)array\_remove(field, param)ARR\_CONTAINS&amp;&amp;ARR\_CONTAINS(field, :param)(field &amp;&amp; param)TO\_TSQUERYto\_tsqueryTO\_TSQUERY(:param)to\_tsquery('param')TO\_TSVECTORto\_tsvectorTO\_TSVECTOR(field)to\_tsvector(field)TS\_MATCH\_OP@@TS\_MATCH\_OP(expr1, expr2)expr1 @@ expr2TS\_CONCAT\_OPUNNESTUNNESTUNNEST(field)UNNEST(field)JSON\_AGGjson\_aggJSON\_AGG(expression)json\_agg(expression)JSONB\_ARRAY\_ELEM\_TEXTjsonb\_array\_elements\_textJSONB\_ARRAY\_ELEM\_TEXT(field, 'json\_field')jsonb\_array\_elements\_text(field)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor3

3 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 ~136 days

Recently: every ~463 days

Total

21

Last Release

1332d ago

Major Versions

v0.8.1 → 1.0.0-rc12022-03-15

PHP version history (3 changes)v0.1.1PHP &gt;=5.4

1.0.0-rc1PHP ^7.3 || ^8.0

v1.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4c71aab9f3e9affbdb47b1dde2001aa94bfbc0a08c6ba36c8aa6ddd5328553ec?d=identicon)[nik-zp](/maintainers/nik-zp)

---

Top Contributors

[![mrVrAlex](https://avatars.githubusercontent.com/u/633883?v=4)](https://github.com/mrVrAlex "mrVrAlex (22 commits)")[![M-E-M-F-I-S](https://avatars.githubusercontent.com/u/3970002?v=4)](https://github.com/M-E-M-F-I-S "M-E-M-F-I-S (8 commits)")[![dmitrijivanenko](https://avatars.githubusercontent.com/u/10165801?v=4)](https://github.com/dmitrijivanenko "dmitrijivanenko (8 commits)")[![maxvoronov](https://avatars.githubusercontent.com/u/8292606?v=4)](https://github.com/maxvoronov "maxvoronov (6 commits)")[![ilyar](https://avatars.githubusercontent.com/u/761285?v=4)](https://github.com/ilyar "ilyar (3 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (2 commits)")[![alexvasilyev](https://avatars.githubusercontent.com/u/265825?v=4)](https://github.com/alexvasilyev "alexvasilyev (2 commits)")[![davividal](https://avatars.githubusercontent.com/u/25622?v=4)](https://github.com/davividal "davividal (2 commits)")[![martin-georgiev](https://avatars.githubusercontent.com/u/4849482?v=4)](https://github.com/martin-georgiev "martin-georgiev (1 commits)")[![lyrixx](https://avatars.githubusercontent.com/u/408368?v=4)](https://github.com/lyrixx "lyrixx (1 commits)")[![andrew-demb](https://avatars.githubusercontent.com/u/12499813?v=4)](https://github.com/andrew-demb "andrew-demb (1 commits)")[![MrZver](https://avatars.githubusercontent.com/u/4669362?v=4)](https://github.com/MrZver "MrZver (1 commits)")[![msheakoski](https://avatars.githubusercontent.com/u/4156?v=4)](https://github.com/msheakoski "msheakoski (1 commits)")[![nik-zp](https://avatars.githubusercontent.com/u/10129751?v=4)](https://github.com/nik-zp "nik-zp (1 commits)")[![sergiors](https://avatars.githubusercontent.com/u/2046276?v=4)](https://github.com/sergiors "sergiors (1 commits)")[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nik-zp-doctrine-dbal-postgresql/health.svg)

```
[![Health](https://phpackages.com/badges/nik-zp-doctrine-dbal-postgresql/health.svg)](https://phpackages.com/packages/nik-zp-doctrine-dbal-postgresql)
```

###  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)
