PHPackages                             jurysosnovsky/doctrine-binary - 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. jurysosnovsky/doctrine-binary

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

jurysosnovsky/doctrine-binary
=============================

The extension to Doctrine 2 that add support for binary functions and bitwise operators available in MySQL, PostgreSQL, Oracle and SQLite.

1.0.1(3y ago)52.3k↓33.3%BSD-3-ClausePHPPHP ^7.2 || ^8.0

Since Jun 29Pushed 3y ago1 watchersCompare

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

READMEChangelogDependencies (5)Versions (3)Used By (0)

Doctrine binary functions and bitwise operators
===============================================

[](#doctrine-binary-functions-and-bitwise-operators)

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

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

[](#installation)

To install with composer:

```
composer require jurysosnovsky/doctrine-binary
```

Usage
-----

[](#usage)

For the Symfony please read [How to Register custom DQL Functions](https://symfony.com/doc/current/doctrine/custom_dql_functions.html).

For the standalone usage 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).

Most of databases uses common bitwise operators like AND (&amp;) OR (|) NOT(~) etc. All available functions present in [config](config).

MySQL
-----

[](#mysql)

There are list of the available bitwise operators:

Bitwise AND (a &amp; b) *DoctrineBinary\\Common\\BitAnd*

Bitwise OR (a | b) *DoctrineBinary\\Common\\BitOr*

Bitwise XOR (a ^ b) *DoctrineBinary\\Common\\BitXor*

Bitwise inversion (~a) *DoctrineBinary\\Common\\BitInversion*

Right shift (a &gt;&gt; b) D*octrineBinary\\Common\\LeftShift*

Left shift (a &lt;&lt; b) *DoctrineBinary\\Common\\RightShift*

There are list of the available binary functions:

BIT\_COUNT(expr) *DoctrineBinary\\Mysql\\BitCount*

BIT\_AND(expr) *DoctrineBinary\\Mysql\\BitAnd*

BIT\_OR(expr) *DoctrineBinary\\Mysql\\BitOr*

BIT\_XOR(expr) *DoctrineBinary\\Mysql\\BitXor*

PostgreSQL
----------

[](#postgresql)

There are list of the available bitwise operators:

Bitwise AND (a &amp; b) *DoctrineBinary\\Common\\BitAnd*

Bitwise OR (a | b) *DoctrineBinary\\Common\\BitOr*

Bitwise exclusive OR (a # b) *DoctrineBinary\\Postgresql\\BitXor*

Bitwise NOT (~a) *DoctrineBinary\\Common\\BitInversion*

Right shift (a &gt;&gt; b) D*octrineBinary\\Common\\LeftShift*

Left shift (a &lt;&lt; b) *DoctrineBinary\\Common\\RightShift*

Oracle
------

[](#oracle)

There are list of the available bitwise operators:

Bitwise AND (a &amp; b) *DoctrineBinary\\Common\\BitAnd*

Bitwise OR (a | b) *DoctrineBinary\\Common\\BitOr*

Bitwise XOR (a ^ b) *DoctrineBinary\\Common\\BitXor*

Bitwise NOT (~a) *DoctrineBinary\\Common\\BitInversion*

Right shift (a &gt;&gt; b) D*octrineBinary\\Common\\LeftShift*

Left shift (a &lt;&lt; b) *DoctrineBinary\\Common\\RightShift*

Zero-fill right shift (a &gt;&gt;&gt; b) *DoctrineBinary\\Oracle\\ZeroFill*

There are list of the available binary functions:

BitAnd *DoctrineBinary\\Oracle\\BitAnd*

BitClear *DoctrineBinary\\Oracle\\BitClear*

BitNot *DoctrineBinary\\Oracle\\BitNot*

BitOr *DoctrineBinary\\Oracle\\BitOr*

BitRotate *DoctrineBinary\\Oracle\\BitRotate*

BitSet *DoctrineBinary\\Oracle\\BitSet*

BitShift *DoctrineBinary\\Oracle\\BitShift*

BitTest *DoctrineBinary\\Oracle\\BitTest*

BitXor *DoctrineBinary\\Oracle\\BitXor*

SQLite
------

[](#sqlite)

There are list of the available bitwise operators:

Bitwise AND (a &amp; b) *DoctrineBinary\\Common\\BitAnd*

Bitwise OR (a | b) *DoctrineBinary\\Common\\BitOr*

Bitwise NOT (~a) *DoctrineBinary\\Common\\BitInversion*

Right shift (a &gt;&gt; b) D*octrineBinary\\Common\\LeftShift*

Left shift (a &lt;&lt; b) *DoctrineBinary\\Common\\RightShift*

Other things
------------

[](#other-things)

Run tests

```
composer run test
```

Code style fixes

```
composer run lint
```

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

[](#troubleshooting)

If you want add something please send pull request.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

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

Total

2

Last Release

1418d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7080271?v=4)[Jury Sosnovsky](/maintainers/jurysosnovsky)[@jurysosnovsky](https://github.com/jurysosnovsky)

---

Tags

databaseormmysqlsqlitedoctrinepostgresqloraclebinarybitwise

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/jurysosnovsky-doctrine-binary/health.svg)

```
[![Health](https://phpackages.com/badges/jurysosnovsky-doctrine-binary/health.svg)](https://phpackages.com/packages/jurysosnovsky-doctrine-binary)
```

###  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)[cycle/database

DBAL, schema introspection, migration and pagination

64690.9k31](/packages/cycle-database)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[ramadan/easy-model

A Laravel package for enjoyably managing database queries.

101.6k](/packages/ramadan-easy-model)[moharrum/laravel-adminer

Adminer database management tool for your Laravel application.

451.0k](/packages/moharrum-laravel-adminer)

PHPackages © 2026

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