PHPackages                             x-laravel/embedding-qdrant-driver - 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. x-laravel/embedding-qdrant-driver

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

x-laravel/embedding-qdrant-driver
=================================

Qdrant vector database similarity driver for x-laravel/embedding.

v1.1.0(1mo ago)00MITPHPPHP ^8.3CI passing

Since May 9Pushed 1mo agoCompare

[ Source](https://github.com/x-laravel/embedding-qdrant-driver)[ Packagist](https://packagist.org/packages/x-laravel/embedding-qdrant-driver)[ RSS](/packages/x-laravel-embedding-qdrant-driver/feed)WikiDiscussions master Synced 1w ago

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

x-laravel/embedding — Qdrant Driver
===================================

[](#x-laravelembedding--qdrant-driver)

[![Tests](https://github.com/x-laravel/embedding-qdrant-driver/actions/workflows/tests.yml/badge.svg)](https://github.com/x-laravel/embedding-qdrant-driver/actions/workflows/tests.yml)[![PHP](https://camo.githubusercontent.com/c8d8dad6beb757a2b8acba331d16140813699543b88a37af0a81f20bd35f61de/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e332532422d626c7565)](https://www.php.net)[![Laravel](https://camo.githubusercontent.com/42e62a9adb05b6cb16993782fd4b04b64a76be3ff5704d170001885eb70c8448/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313225323025374325323031332d726564)](https://laravel.com)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](LICENSE.md)

[Qdrant](https://qdrant.tech) vector database driver for [x-laravel/embedding](https://github.com/x-laravel/embedding).

How It Works
------------

[](#how-it-works)

- Implements `SimilarityDriver` — registers as the `qdrant` driver, similarity search runs entirely in Qdrant using its native ANN (Approximate Nearest Neighbor) engine
- Implements `VectorStore` — writes embeddings to both the SQL `embeddings` table (for Eloquent relationships) and the Qdrant collection (for search)

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

[](#requirements)

- PHP ^8.3
- Laravel ^12.0 | ^13.0
- `x-laravel/embedding ^1.0`
- Qdrant server (self-hosted or [Qdrant Cloud](https://cloud.qdrant.io))

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

[](#installation)

```
composer require x-laravel/embedding-qdrant-driver
```

The `QdrantEmbeddingServiceProvider` is auto-discovered and registers the `qdrant` driver automatically.

Setup
-----

[](#setup)

### 1. Configure x-laravel/embedding

[](#1-configure-x-laravelembedding)

Publish the config if you haven't already:

```
php artisan vendor:publish --tag=embedding-config
```

Set the similarity driver in `config/embedding.php`:

```
'similarity' => [
    'driver' => env('EMBEDDING_SIMILARITY_DRIVER', 'qdrant'),
],
```

### 2. Configure Qdrant

[](#2-configure-qdrant)

Set the following environment variables:

```
EMBEDDING_QDRANT_URL=http://localhost:6333
EMBEDDING_QDRANT_COLLECTION=embeddings
EMBEDDING_QDRANT_API_KEY=          # required for Qdrant Cloud
```

Or publish the config to `config/embedding-qdrant-driver.php` for full customisation:

```
php artisan vendor:publish --tag=embedding-qdrant
```

### 3. Create the Qdrant collection and SQL table

[](#3-create-the-qdrant-collection-and-sql-table)

```
php artisan migrate
```

This publishes both the SQL `embeddings` table migration (from the core package) and creates the Qdrant collection.

> **Note:** The Qdrant collection is created with cosine similarity. The `EMBEDDING_DIMENSIONS` config value sets the vector size — it must match your AI model's output dimension.

### 4. Model

[](#4-model)

Follow the standard `x-laravel/embedding` setup. No Qdrant-specific changes are needed on your models.

```
use XLaravel\Embedding\Attributes\EmbedOn;
use XLaravel\Embedding\Concerns\Embeddable;
use XLaravel\Embedding\Contracts\HasEmbeddings;

#[EmbedOn(['title', 'body'])]
class Post extends Model implements HasEmbeddings
{
    use Embeddable;

    public function toEmbeddingText(): string
    {
        return $this->title.' '.$this->body;
    }
}
```

Usage
-----

[](#usage)

The driver is transparent — use the standard `x-laravel/embedding` API:

```
Post::similarToText('web framework', limit: 10);
Post::similarTo($vector, limit: 10, threshold: 0.8);
Post::rankByRelevance($posts, 'web framework');

$post->mostSimilar(limit: 5);
$post->similarityTo($otherPost);
```

All methods set a `similarity_score` float attribute on each returned model.

Testing
-------

[](#testing)

```
# Build first (once per PHP version)
DOCKER_BUILDKIT=0 docker compose --profile php83 build

# Run tests
docker compose --profile php83 up
docker compose --profile php84 up
docker compose --profile php85 up
```

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](https://opensource.org/license/MIT).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

31d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bdb64c6c087c331b8bd5906bb1aa7eb06bc83af3654a48ba8ab9da365976651?d=identicon)[X-Adam](/maintainers/X-Adam)

---

Top Contributors

[![x-adam](https://avatars.githubusercontent.com/u/60411758?v=4)](https://github.com/x-adam "x-adam (3 commits)")

---

Tags

laravelaivectorembeddingqdrant

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/x-laravel-embedding-qdrant-driver/health.svg)

```
[![Health](https://phpackages.com/badges/x-laravel-embedding-qdrant-driver/health.svg)](https://phpackages.com/packages/x-laravel-embedding-qdrant-driver)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[ntanduy/cloudflare-d1-database

Cloudflare D1 database driver for Laravel — full Eloquent &amp; Query Builder support.

246.8k](/packages/ntanduy-cloudflare-d1-database)

PHPackages © 2026

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