PHPackages                             partitech/doctrine-pgvector - 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. partitech/doctrine-pgvector

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

partitech/doctrine-pgvector
===========================

Postgresql vector type with doctrine

v0.0.8(1y ago)21118.7k↓35.7%5MITPHPPHP ^8.0

Since Feb 6Pushed 1y ago2 watchersCompare

[ Source](https://github.com/partITech/doctrine-pgvector)[ Packagist](https://packagist.org/packages/partitech/doctrine-pgvector)[ RSS](/packages/partitech-doctrine-pgvector/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (9)Used By (0)

Doctrine PgVector
=================

[](#doctrine-pgvector)

Tip

For more detailed information and comprehensive guides, please visit our [official documentation](https://doctrine-pgvector.partitech.com)

Partitech Doctrine PgVector is a Doctrine extension for integrating PostgreSQL vector types into your PHP projects using Doctrine ORM. This module simplifies using vectors in your database by providing calculation functions such as distance, inner product, and cosine similarity.

📦 Installation
--------------

[](#-installation)

You can install Partitech Doctrine PgVector via Composer:

```
composer require partitech/doctrine-pgvector
```

⚙️ Configuration
----------------

[](#️-configuration)

Add the types and functions to your Doctrine configuration:

```
doctrine:
    dbal:
        types:
            vector: Partitech\DoctrinePgVector\Type\VectorType
    orm:
        dql:
            string_functions:
                distance: Partitech\DoctrinePgVector\Query\Distance
                inner_product: Partitech\DoctrinePgVector\Query\InnerProduct
                cosine_similarity: Partitech\DoctrinePgVector\Query\CosineSimilarity
```

🛠️ Usage
--------

[](#️-usage)

### Vector Types

[](#vector-types)

Use vector types directly in your Doctrine entities:

```
/** @Column(type="vector") */
private $vector;
```

### Available DQL Functions

[](#available-dql-functions)

- `distance(vector, vector)`
- `inner_product(vector, vector)`
- `cosine_similarity(vector, vector)`

These functions can be directly used in your Doctrine queries.

📌 Examples
----------

[](#-examples)

Example query using distance:

```
$query = $entityManager->createQuery(
    'SELECT e FROM Entity e ORDER BY distance(e.vector, :inputVector) ASC'
);
$query->setParameter('inputVector', [0.1, 0.2, 0.3]);
$result = $query->getResult();
```

✅ Testing and Development
-------------------------

[](#-testing-and-development)

To run unit tests:

```
composer test
```

🤝 Contribution
--------------

[](#-contribution)

Contributions are welcome! Check the [issues page](https://github.com/partitech/doctrine-pgvector/issues) to start contributing or submit a Pull Request.

📄 License
---------

[](#-license)

This project is licensed under the MIT License. See [LICENSE](LICENSE) for more details.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance44

Moderate activity, may be stable

Popularity43

Moderate usage in the ecosystem

Community16

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 86.5% of commits — single point of failure

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

Recently: every ~76 days

Total

8

Last Release

467d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d641cc3a07941ca1ae0d118292a46c55a0c8e504235316f5635b55ca041ecf48?d=identicon)[partitech](/maintainers/partitech)

---

Top Contributors

[![GeraudBourdin](https://avatars.githubusercontent.com/u/9740283?v=4)](https://github.com/GeraudBourdin "GeraudBourdin (32 commits)")[![ttk](https://avatars.githubusercontent.com/u/1742711?v=4)](https://github.com/ttk "ttk (2 commits)")[![partITech](https://avatars.githubusercontent.com/u/117969827?v=4)](https://github.com/partITech "partITech (1 commits)")[![RobinDev](https://avatars.githubusercontent.com/u/3944894?v=4)](https://github.com/RobinDev "RobinDev (1 commits)")[![thomasbeaujean](https://avatars.githubusercontent.com/u/5817919?v=4)](https://github.com/thomasbeaujean "thomasbeaujean (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/partitech-doctrine-pgvector/health.svg)

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

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