1. Go to this page and download the library: Download tenqz/qdrant library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tenqz / qdrant example snippets
use Tenqz\Qdrant\QdrantClient;
use Tenqz\Qdrant\Transport\Infrastructure\Factory\CurlHttpClientFactory;
// 1. Create client
$factory = new CurlHttpClientFactory();
$httpClient = $factory->create('localhost', 6333);
$client = new QdrantClient($httpClient);
// 2. Create collection
$client->createCollection('my_collection', 4, 'Cosine');
// 3. Add vectors with data
$client->upsertPoints('my_collection', [
['id' => 1, 'vector' => [0.1, 0.2, 0.3, 0.4], 'payload' => ['city' => 'Berlin']],
['id' => 2, 'vector' => [0.5, 0.6, 0.7, 0.8], 'payload' => ['city' => 'London']],
]);
// 4. Search for similar vectors
$results = $client->search('my_collection', [0.2, 0.1, 0.9, 0.7], 5);