claudiogs16/laravel-sdk-qdrant

Laravel SDK for Qdrant vector database — search, upsert, collections, payload management with OpenAI, Gemini and OpenRouter embedders

Maintainers

Package info

github.com/claudiogs16/laravel-sdk-qdrant

pkg:composer/claudiogs16/laravel-sdk-qdrant

Statistics

Installs: 6

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.1.0 2026-05-17 16:44 UTC

This package is auto-updated.

Last update: 2026-05-17 16:57:44 UTC


README

Latest Version on Packagist License PHP Version Laravel

Laravel SDK for Qdrant vector database. Supports collection management, point operations (upsert, search, scroll, recommend, count), payload manipulation, index management, and vector embedding via OpenAI, Gemini, and OpenRouter.

Forked from wontonee/laravel-qdrant-sdk with compatibility for Laravel 11, 12, and 13, re-namespaced to Claudiogs16\LarQ, and added OpenRouter embedder support.

Installation

composer require claudiogs16/laravel-sdk-qdrant

Laravel auto-discovers the service provider. Publish the config:

php artisan vendor:publish --tag=larq-config

Configuration

Add to your .env:

LARQ_HOST=http://localhost:6333
LARQ_API_KEY=

# OpenAI
OPENAI_API_KEY=sk-...
OPENAI_MODEL=text-embedding-3-small

# Gemini
GEMINI_API_KEY=
GEMINI_MODEL=models/embedding-001

# OpenRouter (OpenAI-compatible API)
OPENROUTER_API_KEY=sk-or-v1-...
OPENROUTER_MODEL=openai/text-embedding-3-small
# OPENROUTER_BASE_URL=https://openrouter.ai/api/v1

The published config is at config/larq.php.

Usage

Client

use Claudiogs16\LarQ\Qdrant\Client;

$client = new Client();

// Raw HTTP calls
$response = $client->get('/collections');
$response = $client->put('/collections/my-collection', [...]);
$response = $client->post('/collections/my-collection/points/search', [...]);

Collections

use Claudiogs16\LarQ\Qdrant\Collections\CreateCollection;
use Claudiogs16\LarQ\Qdrant\Collections\ListCollections;
use Claudiogs16\LarQ\Qdrant\Collections\GetCollection;
use Claudiogs16\LarQ\Qdrant\Collections\UpdateCollection;
use Claudiogs16\LarQ\Qdrant\Collections\DeleteCollection;

CreateCollection::make()->handle('my-collection', [
    'vectors' => ['size' => 1536, 'distance' => 'Cosine'],
]);

$collections = ListCollections::make()->handle();
$info = GetCollection::make()->handle('my-collection');

Points

use Claudiogs16\LarQ\Qdrant\Points\UpsertPoints;
use Claudiogs16\LarQ\Qdrant\Points\SearchPoints;
use Claudiogs16\LarQ\Qdrant\Points\ScrollPoints;
use Claudiogs16\LarQ\Qdrant\Points\CountPoints;
use Claudiogs16\LarQ\Qdrant\Points\DeletePoints;
use Claudiogs16\LarQ\Qdrant\Points\RecommendPoints;

// Upsert
UpsertPoints::make()->handle('my-collection', [
    [
        'id' => 1,
        'vector' => [0.1, 0.2, ...],
        'payload' => ['title' => 'Document 1'],
    ],
]);

// Search
$results = SearchPoints::make()->handle('my-collection', [
    'vector' => [0.1, 0.2, ...],
    'limit' => 10,
]);

// Count
$count = CountPoints::make()->handle('my-collection');

Payload

use Claudiogs16\LarQ\Qdrant\Payload\SetPayload;
use Claudiogs16\LarQ\Qdrant\Payload\DeletePayload;
use Claudiogs16\LarQ\Qdrant\Payload\ClearPayload;

Indexes

use Claudiogs16\LarQ\Qdrant\Index\CreateIndex;
use Claudiogs16\LarQ\Qdrant\Index\DeleteIndex;

Vectors

use Claudiogs16\LarQ\Qdrant\Vectors\DeleteVector;

Embedders

use Claudiogs16\LarQ\Embedders\OpenAIEmbedder;
use Claudiogs16\LarQ\Embedders\GeminiEmbedder;
use Claudiogs16\LarQ\Embedders\OpenRouterEmbedder;

// OpenAI
$embedder = new OpenAIEmbedder();
$vector = $embedder->embed('Some text to embed');

// Gemini
$gemini = new GeminiEmbedder();
$vector = $gemini->embed('Some text to embed');

// OpenRouter
$openrouter = new OpenRouterEmbedder();
$vector = $openrouter->embed('Some text to embed');

Eloquent Trait

use Claudiogs16\LarQ\Traits\HasVectors;

class Document extends Model
{
    use HasVectors;

    // Optional overrides:
    protected function getVectorText(): string { ... }
    protected function getVectorPayload(): array { ... }
    protected function getVectorId(): string|int { ... }
    protected function getVectorCollection(): string { ... }
    protected function getEmbedder(): EmbedderInterface { ... }
}

$document->upsertToQdrant();

Testing

composer test

Requirements

  • PHP 8.2+
  • Laravel 11.x | 12.x | 13.x

License

MIT