{"id":35277396,"url":"https://github.com/hkulekci/qdrant-php","last_synced_at":"2025-12-30T14:04:53.291Z","repository":{"id":145601858,"uuid":"614270074","full_name":"hkulekci/qdrant-php","owner":"hkulekci","description":"Qdrant is a vector similarity engine \u0026 vector database. It deploys as an API service providing search for the nearest high-dimensional vectors. With Qdrant, embeddings or neural network encoders can be turned into full-fledged applications for matching, searching, recommending, and much more!","archived":false,"fork":false,"pushed_at":"2024-11-30T06:05:31.000Z","size":209,"stargazers_count":120,"open_issues_count":4,"forks_count":26,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-07T12:35:28.864Z","etag":null,"topics":["php","php-client","qdrant","qdrant-vector-database"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hkulekci.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-15T08:48:44.000Z","updated_at":"2025-06-05T15:11:08.000Z","dependencies_parsed_at":"2024-11-30T07:20:04.156Z","dependency_job_id":"8ffa247a-53db-4983-a1aa-66f43e5612e6","html_url":"https://github.com/hkulekci/qdrant-php","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/hkulekci/qdrant-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkulekci%2Fqdrant-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkulekci%2Fqdrant-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkulekci%2Fqdrant-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkulekci%2Fqdrant-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hkulekci","download_url":"https://codeload.github.com/hkulekci/qdrant-php/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hkulekci%2Fqdrant-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28127989,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-30T02:00:05.476Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["php","php-client","qdrant","qdrant-vector-database"],"created_at":"2025-12-30T14:02:36.687Z","updated_at":"2025-12-30T14:04:53.274Z","avatar_url":"https://github.com/hkulekci.png","language":"PHP","readme":"# Qdrant PHP Client\n\n[![Test Application](https://github.com/hkulekci/qdrant-php/actions/workflows/test.yaml/badge.svg)](https://github.com/hkulekci/qdrant-php/actions/workflows/test.yaml) [![codecov](https://codecov.io/github/hkulekci/qdrant-php/branch/main/graph/badge.svg?token=5K8FAI0C9B)](https://codecov.io/github/hkulekci/qdrant-php)\n\nThis library is a PHP Client for Qdrant.  \n\nQdrant is a vector similarity engine \u0026 vector database. It deploys as an API service providing search for the nearest \nhigh-dimensional vectors. With Qdrant, embeddings or neural network encoders can be turned into full-fledged \napplications for matching, searching, recommending, and much more!\n\n# Installation\n\nYou can install the client in your PHP project using composer:\n\n```shell\ncomposer require hkulekci/qdrant\n```\n\n### Connecting to Qdrant \n\n```php\ninclude __DIR__ . \"/../vendor/autoload.php\";\ninclude_once 'config.php';\n\nuse Qdrant\\Qdrant;\nuse Qdrant\\Config;\nuse Qdrant\\Http\\Builder;\n\n$config = new Config(QDRANT_HOST);\n$config-\u003esetApiKey(QDRANT_API_KEY);\n\n$transport = (new Builder())-\u003ebuild($config);\n$client = new Qdrant($transport);\n```\n\n### Creating a Collection\n\n```php\nuse Qdrant\\Endpoints\\Collections;\nuse Qdrant\\Models\\Request\\CreateCollection;\nuse Qdrant\\Models\\Request\\VectorParams;\n\n$createCollection = new CreateCollection();\n$createCollection-\u003eaddVector(new VectorParams(1536, VectorParams::DISTANCE_COSINE), 'content');\n$response = $client-\u003ecollections('contents')-\u003ecreate($createCollection);\n```\n\n### Inserting Points Into Collection\n\n```php\nuse Qdrant\\Models\\PointsStruct;\nuse Qdrant\\Models\\PointStruct;\nuse Qdrant\\Models\\VectorStruct;\n\n$openai = OpenAI::client(OPENAI_API_KEY);\n\n$query = 'sustainable agricultural startups';\n$response = $openai-\u003eembeddings()-\u003ecreate([\n    'model' =\u003e 'text-embedding-ada-002',\n    'input' =\u003e $query,\n]);\n$embedding = array_values($response-\u003eembeddings[0]-\u003eembedding);\n\n$points = new PointsStruct();\n$points-\u003eaddPoint(\n    new PointStruct(\n        (int) $imageId,\n        new VectorStruct($embedding, 'content'),\n        [\n            'id' =\u003e 1,\n            'meta' =\u003e 'Meta data'\n        ]\n    )\n);\n$client-\u003ecollections('contents')-\u003epoints()-\u003eupsert($points);\n```\n\n### Wait for Acknowledges\n\nWhile upsert data, if you want to wait for upsert to actually happen, you can use query parameters:\n\n```php\n$client-\u003ecollections('contents')-\u003epoints()-\u003eupsert($points, ['wait' =\u003e 'true']);\n```\n\nYou can check for more parameters : https://qdrant.github.io/qdrant/redoc/index.html#tag/points/operation/upsert_points\n\n### Search on Points\n\nSearch with a filter :\n\n```php\nuse Qdrant\\Models\\Filter\\Condition\\MatchString;\nuse Qdrant\\Models\\Filter\\Filter;\nuse Qdrant\\Models\\Request\\SearchRequest;\nuse Qdrant\\Models\\VectorStruct;\n\n$searchRequest = (new SearchRequest(new VectorStruct($embedding, 'elev_pitch')))\n    -\u003esetFilter(\n        (new Filter())-\u003eaddMust(\n            new MatchString('name', 'Palm')\n        )\n    )\n    -\u003esetLimit(10)\n    -\u003esetParams([\n        'hnsw_ef' =\u003e 128,\n        'exact' =\u003e false,\n    ])\n    -\u003esetWithPayload(true);\n\n$response = $client-\u003ecollections('contents')-\u003epoints()-\u003esearch($searchRequest);\n```\n\n### Search on Points with OpenAI Embeddings\n\n```php\n$openai = OpenAI::client(OPENAI_API_KEY);\n\n$query = 'lorem ipsum dolor sit amed';\n$response = $openai-\u003eembeddings()-\u003ecreate([\n    'model' =\u003e 'text-embedding-ada-002',\n    'input' =\u003e $query,\n]);\n$embedding = array_values($response-\u003eembeddings[0]-\u003eembedding);\n\n$searchRequest = (new SearchRequest(new VectorStruct($embedding, 'content')))\n    -\u003esetLimit(10)\n    -\u003esetParams([\n        'hnsw_ef' =\u003e 128,\n        'exact' =\u003e false,\n    ])\n    -\u003esetWithPayload(true);\n\n$response = $client-\u003ecollections('contents')-\u003epoints()-\u003esearch($searchRequest);\n\nforeach ($response['result'] as $item) {\n    echo $item['score'] . ';' . $item['payload']['id'] . ';' . $item['payload']['meta_data'] . PHP_EOL;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkulekci%2Fqdrant-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhkulekci%2Fqdrant-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhkulekci%2Fqdrant-php/lists"}