PHPackages                             somework/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. [Database &amp; ORM](/categories/database)
4. /
5. somework/doctrine-dbal-postgresql

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

somework/doctrine-dbal-postgresql
=================================

Extensions for support Postgres in Doctrine DBAL &amp; DQL

1.0.1(4y ago)018MITPHPPHP &gt;=7.4

Since Apr 5Pushed 4y agoCompare

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

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

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

[](#doctrine-dbal-postgresql)

[![Latest Stable Version](https://camo.githubusercontent.com/278e4d6d1fd8a0b53f52ef862596a9a3fc7d1d036f67c303a30094986886f31a/687474703a2f2f706f7365722e707567782e6f72672f736f6d65776f726b2f646f637472696e652d6462616c2d706f737467726573716c2f76)](https://packagist.org/packages/somework/doctrine-dbal-postgresql) [![Total Downloads](https://camo.githubusercontent.com/2cfc3189d6cfac838b698251a9d941b0358a3106053189567cc82ac20ba02e3b/687474703a2f2f706f7365722e707567782e6f72672f736f6d65776f726b2f646f637472696e652d6462616c2d706f737467726573716c2f646f776e6c6f616473)](https://packagist.org/packages/somework/doctrine-dbal-postgresql) [![Latest Unstable Version](https://camo.githubusercontent.com/31c4a08d3ea50e60f61669cad5d8bdd4ba76bf67eb5104a96badf2fb4dc531a0/687474703a2f2f706f7365722e707567782e6f72672f736f6d65776f726b2f646f637472696e652d6462616c2d706f737467726573716c2f762f756e737461626c65)](https://packagist.org/packages/somework/doctrine-dbal-postgresql) [![License](https://camo.githubusercontent.com/3048e5e644147797f92af2109c184d0757e37da1a262f4a2fe15f260a5254cc3/687474703a2f2f706f7365722e707567782e6f72672f736f6d65776f726b2f646f637472696e652d6462616c2d706f737467726573716c2f6c6963656e7365)](https://packagist.org/packages/somework/doctrine-dbal-postgresql) [![PHP Version Require](https://camo.githubusercontent.com/3bff52723230f4aca008a4483f354fc13f516bc571dfe0f3ccefa876639a87ef/687474703a2f2f706f7365722e707567782e6f72672f736f6d65776f726b2f646f637472696e652d6462616c2d706f737467726573716c2f726571756972652f706870)](https://packagist.org/packages/somework/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 somework/doctrine-dbal-postgresql:~1.0
```

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

To use the new functions you should register them using the [DQL User Defined Functions](http://docs.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 datbase 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

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity73

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

Recently: every ~396 days

Total

21

Last Release

1607d ago

Major Versions

v0.8.1 → 1.0.02021-12-23

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

1.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/19801428?v=4)[Igor Pinchuk](/maintainers/somework)[@somework](https://github.com/somework)

---

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)")[![somework](https://avatars.githubusercontent.com/u/19801428?v=4)](https://github.com/somework "somework (4 commits)")[![ilyar](https://avatars.githubusercontent.com/u/761285?v=4)](https://github.com/ilyar "ilyar (3 commits)")[![davividal](https://avatars.githubusercontent.com/u/25622?v=4)](https://github.com/davividal "davividal (2 commits)")[![alexvasilyev](https://avatars.githubusercontent.com/u/265825?v=4)](https://github.com/alexvasilyev "alexvasilyev (2 commits)")[![adrienbrault](https://avatars.githubusercontent.com/u/611271?v=4)](https://github.com/adrienbrault "adrienbrault (2 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)")[![MrZver](https://avatars.githubusercontent.com/u/4669362?v=4)](https://github.com/MrZver "MrZver (1 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)")[![msheakoski](https://avatars.githubusercontent.com/u/4156?v=4)](https://github.com/msheakoski "msheakoski (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[scienta/doctrine-json-functions

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

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

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[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)[bartlett/php-compatinfo-db

Reference Database of all functions, constants, classes, interfaces on PHP standard distribution and about 110 extensions

1183.0k1](/packages/bartlett-php-compatinfo-db)[heymoon/doctrine-psql-enum

Store PHP native enums as PostgeSQL custom enum types

254.9k](/packages/heymoon-doctrine-psql-enum)

PHPackages © 2026

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