PHPackages                             mcpuishor/qdrant-laravel - 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. mcpuishor/qdrant-laravel

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

mcpuishor/qdrant-laravel
========================

A fluent package to interact with Qdrant Vector Database

v0.1.0(1y ago)916.4k↓55.4%5[1 issues](https://github.com/mcpuishor/qdrant-laravel/issues)MITPHPPHP ^8.2|^8.3CI passing

Since Jun 21Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/mcpuishor/qdrant-laravel)[ Packagist](https://packagist.org/packages/mcpuishor/qdrant-laravel)[ RSS](/packages/mcpuishor-qdrant-laravel/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Qdrant for Laravel
==================

[](#qdrant-for-laravel)

Introduction
------------

[](#introduction)

This package provides an elegant, fluent interface for interacting with the [Qdrant Vector Database](https://qdrant.tech/) in Laravel. Qdrant is a vector similarity search engine that makes it easy to store and search for embeddings, making it ideal for AI-powered applications.

Key features:

- Simple collection management
- Fluent search API with filtering and grouping
- Efficient point operations (insert, upsert, delete)
- Vector operations (update, delete)
- Laravel Facade support
- Convenient payload handling

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

[](#installation)

### 1. Install via Composer

[](#1-install-via-composer)

```
composer require mcpuishor/qdrant-laravel
```

### 2. Publish the Configuration File

[](#2-publish-the-configuration-file)

```
php artisan vendor:publish --tag=qdrant-laravel-config
```

This will create a `config/qdrant-laravel.php` file where you can set your Qdrant connections and defaults.

### 3. Set Up Your `.env` File

[](#3-set-up-your-env-file)

Update your `.env` file with your Qdrant host details:

```
QDRANT_DEFAULT=main
QDRANT_HOST=http://localhost:6333
QDRANT_COLLECTION=collection_name
QDRANT_VECTOR_SIZE=1536
QDRANT_DEFAULT_DISTANCE_METRIC=Cosine
```

Configuration
-------------

[](#configuration)

The `config/qdrant-laravel.php` file allows multiple connections:

```
return [
    'default' => env('QDRANT_DEFAULT', 'main'),

    'connections' => [
        'main' => [
            'host' => env('QDRANT_HOST', 'http://localhost:6333'),
            'api_key' => env('QDRANT_API_KEY', null),
            'collection' => env('QDRANT_COLLECTION', 'default_collection'),
            'vector_size' => env('QDRANT_VECTOR_SIZE', 128),
        ],
    ],

    'default_distance_metric' => env('QDRANT_DEFAULT_DISTANCE_METRIC', 'Cosine'),
];
```

Schema Management (Migrations)
------------------------------

[](#schema-management-migrations)

### Creating a new collection

[](#creating-a-new-collection)

A collection must contain at least one vector. An optional parameter `options` can contain additional parameters described as an associative array. See the [Qdrant documentation](https://api.qdrant.tech/api-reference/collections/create-collection) for details. The options can be specified using arrays or DataObjects defined in the package.

The response is a boolean value, unless an exception is thrown.

```
use \Mcpuishor\QdrantLaravel\Facades\Schema;
use \Mcpuishor\QdrantLaravel\Enums\DistanceMetric;
use \Mcpuishor\QdrantLaravel\DTOs\Vector;

$vector = Vector::fromArray([
            'size' => 128,
            'distance' => DistanceMetric::COSINE
       ]);

$response = Schema::create(
                   name: "new_collection",
                   vector: $vector,
                   options: []
                );

if ($response) {
    echo "Schema created successfully";
}
```

### Creating a new collection on a different connection

[](#creating-a-new-collection-on-a-different-connection)

You can switch the connection at runtime. The connection must be defined in the `config\qdrant-laravel.php` file.

```
use \Mcpuishor\QdrantLaravel\Schema;
use \Mcpuishor\QdrantLaravel\Enums\DistanceMetric;
use \Mcpuishor\QdrantLaravel\DTOs\Vector;

$vector = Vector::fromArray([
            'size' => 128,
            'distance' => DistanceMetric::COSINE
       ]);

$response = Schema::connection('backup')
                ->create(
                   name: "new_collection",
                   vector: $vector,
                );

if ($response) {
    echo "Schema created successfully";
}
```

### Creating a collection with multiple vectors

[](#creating-a-collection-with-multiple-vectors)

A collection can contain multiple vectors per point. They need to be passed on to the `Schema::create`as an array containing the definitions of each vector. The vectors can have different definitions. The optional parameters can be specified using Data Objects defined in the package.

```
use \Mcpuishor\QdrantLaravel\Schema;
use \Mcpuishor\QdrantLaravel\QdrantTransport;
use \Mcpuishor\QdrantLaravel\Enums\DistanceMetric;
use \Mcpuishor\QdrantLaravel\DTOs\Vector;
use \Mcpuishor\QdrantLaravel\DTOs\HnswConfig;

$vector1 = Vector::fromArray([
            'size' => 128,
            'distance' => DistanceMetric::COSINE
            //optional parameters
            'on_disk' => true,
            ]);

$vector2 = Vector::fromArray([
            'size' => 1024,
            'distance' => DistanceMetric::COSINE,
            //optional parameters
            'hsnw_config' => Hnswconfig::fromArray([
                    'm' => 10,
                    'ef_construct' => 4,
                    'on_disk' => true,
                ]),
            ]);

$response = Schema::create(
               name: "new_collection",
               vector: array($vector1, $vector2),
            );

if ($response) {
    echo "Schema created successfully";
}
```

Deleting a collection
---------------------

[](#deleting-a-collection)

To delete a collection, you can call the `delete` method on the `Schema` facade. It returns a `Mcpuishor\QdrantLaravel\DTOs\Response` object.

```
use \Mcpuishor\QdrantLaravel\Facades\Schema;

$result = Schema::delete('collection_name');

if ($result) {
    echo "Collection has been successfully deleted.";
}
```

Collection existence
--------------------

[](#collection-existence)

To check if the collection defined in the config on the current connection exists:

```
use \Mcpuishor\QdrantLaravel\Facades\Schema;

if ( Schema::exists() ) {
    echo "Collection exists.";
}
```

At the same time, you can check the existence of a different collection on the same connection:

```
use \Mcpuishor\QdrantLaravel\Facades\Schema;

if ( Schema::exists( 'another_collection' ) ) {
    echo "Collection 'another_collection' exists.";
}
```

Updating a collection
---------------------

[](#updating-a-collection)

Updating parameters on an existing collection can be done in a similar fashion to creating one. The parameters updated can be specified using arrays or Data Objects defined in the package.

Updating the collection defined in the `config\qdrant-laravel.php`:

```
use \Mcpuishor\QdrantLaravel\Facades\Schema;
use \Mcpuishor\QdrantLaravel\DTOs\HnswConfig;
use \Mcpuishor\QdrantLaravel\DTOs\Collection\Params;

Schema::update(
    vectors: [

    ],
    options: [
       'hnsw_config' => HnswConfig::fromArray([
                'm' => 100,
                'ef_construct' => 5,
            ]),
       'params' => Params::fromArray([
                'replication_factor' => 4,
                'on_disk_payload' => true,
            ]),
    ]
);
```

Indexing a collection
---------------------

[](#indexing-a-collection)

Indexes in a Qdrant vector collection are created on the payload for each vector. For more details see the [Qdrant documentation](https://qdrant.tech/documentation/concepts/indexing/).

### Creating an index

[](#creating-an-index)

To create a payload index over a field:

```
use \Mcpuishor\QdrantLaravel\Facades\Qdrant;
use \Mcpuishor\QdrantLaravel\Enums\FieldType;

$result = Qdrant::indexes()->add('field_name', FieldType::KEYWORD);
```

It returns `true` if the operation was successful, or `false` otherwise.

You can use dot notation to create indexes over nested fields.

By default, indexes are stored in memory. If you have large indexes, and they need to be stored on the disk, you can use the `->onDisk()` method before creating the index. Choose carefully when to store an index on the disk, as this will introduce some latency in your future queries.

### Parameterized integer indexes

[](#parameterized-integer-indexes)

Qdrant v1.8.0 has introduced a parameterized variant of the integer index. To turn the parameterized index on you can call the `->parameterized()`method before creating an `integer` index. This setting is used only for `integer` fields in the payload.

Values of the `lookup` and `range` can be toggled in the `config\qdrant-laravel.php` file. For more information on parameterized integer indexes and how they affect performance check the [Qdrant documentation](https://qdrant.tech/documentation/concepts/indexing/#parameterized-index)

```
    $result = Qdrant::indexes()->parameterized()->add('field_name', FieldType::INTEGER);
```

It returns `true` if the operation was successful, or `false` otherwise.

### Full-text indexes

[](#full-text-indexes)

Qdrant supports full-text search for string payload. Full-text index allows you to filter points by the presence of a word or a phrase in the payload field.

```
    use \Mcpuishor\QdrantLaravel\Enums\TokenizerType;
    use \Mcpuishor\QdrantLaravel\Facades\Qdrant;

    $result = Qdrant::indexes()->fulltext('text_field_name', TokenizerType::WORD);
```

It returns `true` if the operation was successful, or `false` otherwise.

### Deleting an index

[](#deleting-an-index)

```
    use \Mcpuishor\QdrantLaravel\Facades\Qdrant;

    $result = Qdrant::indexes()->delete('payload_field');
```

It returns `true` if the operation was successful, or `false` otherwise.

Searching
---------

[](#searching)

The package provides a fluent interface for searching vectors in your Qdrant collection.

### Basic Vector Search

[](#basic-vector-search)

To perform a simple search with a vector:

```
use Mcpuishor\QdrantLaravel\Facades\Qdrant;

// Search using a vector
$results = Qdrant::search()
    ->vector([0.2, 0.3, 0.4, ...]) // Your vector data
    ->limit(10)
    ->get();
```

### Search by Point ID

[](#search-by-point-id)

You can also search for similar points to an existing point by its ID:

```
use Mcpuishor\QdrantLaravel\Facades\Qdrant;
use Mcpuishor\QdrantLaravel\DTOs\Point;

$point = new Point(id: 123);
$results = Qdrant::search()
    ->point($point)
    ->limit(5)
    ->get();
```

### Including Payload and Vectors

[](#including-payload-and-vectors)

Control what data is returned with your search results:

```
// Include all payload data
$results = Qdrant::search()
    ->vector($vector)
    ->withPayload()
    ->get();

// Include only specific payload fields
$results = Qdrant::search()
    ->vector($vector)
    ->include(['name', 'description'])
    ->get();

// Exclude specific payload fields
$results = Qdrant::search()
    ->vector($vector)
    ->exclude(['internal_id'])
    ->get();

// Include vector data in results
$results = Qdrant::search()
    ->vector($vector)
    ->withVectors()
    ->get();
```

### Pagination

[](#pagination)

Control the number of results and implement pagination:

```
// Limit results
$results = Qdrant::search()
    ->vector($vector)
    ->limit(20)
    ->get();

// Pagination with offset
$results = Qdrant::search()
    ->vector($vector)
    ->limit(10)
    ->offset(20) // Skip first 20 results
    ->get();
```

### Filtering Results

[](#filtering-results)

Apply filters to search results using the fluent filter API:

```
// Simple equality filter
$results = Qdrant::search()
    ->vector($vector)
    ->where('category', '=', 'electronics')
    ->get();

// Range filter
$results = Qdrant::search()
    ->vector($vector)
    ->where('price', '>=', 100)
    ->where('price', 'limit(10)
    ->get();
```

### Recommendation Strategy

[](#recommendation-strategy)

Control how vectors are combined for recommendations:

```
use Mcpuishor\QdrantLaravel\Enums\AverageVectorStrategy;

$recommendations = Qdrant::recommend()
    ->positive([123, 456])
    ->strategy(AverageVectorStrategy::WEIGHTED) // Use weighted average
    ->limit(10)
    ->get();
```

Available strategies include:

- `AverageVectorStrategy::MEAN` - Simple average of vectors
- `AverageVectorStrategy::WEIGHTED` - Weighted average based on similarity

Point Operations
----------------

[](#point-operations)

The package provides methods for managing points in your Qdrant collection.

### Retrieving Points

[](#retrieving-points)

Get points by their IDs:

```
use Mcpuishor\QdrantLaravel\Facades\Qdrant;

// Get multiple points
$points = Qdrant::points()->get([123, 456, 789]);

// Find a single point
$point = Qdrant::points()->find(123);
```

### Controlling Returned Data

[](#controlling-returned-data)

Control what data is returned with the points:

```
// With payload (default)
$points = Qdrant::points()->withPayload()->get([123, 456]);

// Without payload
$points = Qdrant::points()->withoutPayload()->get([123, 456]);

// With vector data
$points = Qdrant::points()->withVector()->get([123, 456]);

// Without vector data (default)
$points = Qdrant::points()->withoutVector()->get([123, 456]);
```

### Inserting Points

[](#inserting-points)

Insert a new point into the collection:

```
use Mcpuishor\QdrantLaravel\DTOs\Point;

// Create a point
$point = new Point(
    id: 123,
    vector: [0.2, 0.3, 0.4, ...],
    payload: ['name' => 'Example', 'category' => 'test']
);

// Insert the point
$success = Qdrant::points()->insert($point);
```

### Upserting Points

[](#upserting-points)

Insert or update multiple points:

```
use Mcpuishor\QdrantLaravel\PointsCollection;
use Mcpuishor\QdrantLaravel\DTOs\Point;

// Create points collection
$points = new PointsCollection([
    new Point(id: 123, vector: [0.2, 0.3, 0.4, ...], payload: ['name' => 'First']),
    new Point(id: 456, vector: [0.5, 0.6, 0.7, ...], payload: ['name' => 'Second'])
]);

// Upsert the points
$success = Qdrant::points()->upsert($points);
```

### Deleting Points

[](#deleting-points)

Delete points by their IDs:

```
// Delete specific points
$success = Qdrant::points()->delete([123, 456]);

// Delete points matching a filter
$success = Qdrant::points()
    ->where('category', '=', 'test')
    ->delete([]);
```

### Autochunking

[](#autochunking)

Efficiently handle large numbers of points with automatic chunking:

```
// Create an autochunker with chunk size of 100
$chunker = Qdrant::points()->autochunk(100);

// Add points - they'll be automatically upserted when the chunk size is reached
foreach ($largeDataset as $data) {
    $point = new Point(
        id: $data['id'],
        vector: $data['embedding'],
        payload: $data['metadata']
    );
    $chunker->add($point);
}

// Manually flush any remaining points
$chunker->flush();
```

Vector Operations
-----------------

[](#vector-operations)

The package provides methods for managing vectors in your Qdrant collection.

### Updating Vectors

[](#updating-vectors)

Update vectors for existing points:

```
use Mcpuishor\QdrantLaravel\Facades\Qdrant;
use Mcpuishor\QdrantLaravel\PointsCollection;
use Mcpuishor\QdrantLaravel\DTOs\Point;

// Create a collection of points with updated vectors
$points = new PointsCollection([
    new Point(id: 123, vector: [0.2, 0.3, 0.4, ...]),
    new Point(id: 456, vector: [0.5, 0.6, 0.7, ...])
]);

// Update the vectors
$success = Qdrant::vectors()->update($points);
```

### Deleting Vectors

[](#deleting-vectors)

Delete vectors for specific points:

```
use Mcpuishor\QdrantLaravel\Facades\Qdrant;

// Delete vectors for specific points
$success = Qdrant::vectors()->delete([123, 456]);
```

Artisan Commands
----------------

[](#artisan-commands)

### Creating a Collection with indexes

[](#creating-a-collection-with-indexes)

```
php artisan qdrant:migrate --collection=plants --vector-size=256 --distance-metric=euclidean --indexes='{"species":"text","age":"integer"}'
```

### Rolling Back a Migration (Dropping Collection &amp; Indexes)

[](#rolling-back-a-migration-dropping-collection--indexes)

```
php artisan qdrant:migrate --rollback --collection=plants
```

Extending with Macros
---------------------

[](#extending-with-macros)

The query builder and client are **Macroable**, allowing custom methods:

```
use Mcpuishor\QdrantLaravel\QdrantClient;

QdrantClient::macro('byClimate', function ($climate) {
    return $this->where('climate', '=', $climate);
});

$results = Qdrant::collection('plants')->byClimate('tropical')->get();
```

Conclusion
----------

[](#conclusion)

This package simplifies working with Qdrant in Laravel, making it easy to integrate **vector search** and **AI-powered applications**. Contributions are welcome!

---

### **License**

[](#license)

This package is open-source and available under the [MIT License](LICENSE).

###  Health Score

37

—

LowBetter than 81% of packages

Maintenance49

Moderate activity, may be stable

Popularity34

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.7% 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

Unknown

Total

1

Last Release

379d ago

### Community

Maintainers

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

---

Top Contributors

[![mcpuishor](https://avatars.githubusercontent.com/u/40750444?v=4)](https://github.com/mcpuishor "mcpuishor (78 commits)")[![happyDemon](https://avatars.githubusercontent.com/u/38573?v=4)](https://github.com/happyDemon "happyDemon (1 commits)")

---

Tags

laravelqdrantvector-database

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/mcpuishor-qdrant-laravel/health.svg)

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

###  Alternatives

[illuminate/database

The Illuminate Database package.

2.8k54.9M11.7k](/packages/illuminate-database)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[lemaur/eloquent-publishing

218.1k1](/packages/lemaur-eloquent-publishing)

PHPackages © 2026

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