Download the PHP package hejunjie/milvus without Composer
On this page you can find all versions of the php package hejunjie/milvus. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hejunjie/milvus
More information about hejunjie/milvus
Files in hejunjie/milvus
Package milvus
Short Description 一个轻量级的 PHP 库,用来通过 RESTful API 调用 Milvus 向量数据库,可以用它来管理集合、插入数据,以及进行向量搜索 | A lightweight PHP library for interacting with the Milvus vector database via RESTful API. It allows you to manage collections, insert data, and perform vector searches
License MIT
Informations about the package milvus
hejunjie/milvus
English | 简体中文
A lightweight PHP library for interacting with the Milvus vector database via RESTful API — manage collections, insert data, and perform vector searches, all in one place.
This project has been parsed by Zread. Click here for a quick overview of the project structure.
Requirements
- PHP 8.0+
- ext-curl
- ext-json
Installation
Quick Start
API Overview
All methods are accessed via chained calls, organized by module:
Client
| Method | Description |
|---|---|
customize($url, $params) |
Custom request for calling APIs not yet wrapped |
Collections
| Method | Description |
|---|---|
create($name, $schema, $indexParams) |
Create a collection |
describe($name) |
Get collection details |
drop($name) |
Drop a collection |
get_load_state($name) |
Get collection load state |
get_stats($name) |
Get collection statistics |
has($name) |
Check if a collection exists |
list() |
List all collections |
load($name) |
Load a collection into memory |
release($name) |
Release a collection from memory |
rename($name, $newName) |
Rename a collection |
alter_properties($name, $properties) |
Set collection properties (e.g., TTL, mmap) |
drop_properties($name, $keys) |
Remove collection properties |
Partitions
| Method | Description |
|---|---|
create($collectionName, $partitionName) |
Create a partition |
drop($collectionName, $partitionName) |
Drop a partition |
get_stats($collectionName, $partitionName) |
Get partition load state |
has($collectionName, $partitionName) |
Check if a partition exists |
list($collectionName) |
List all partitions |
load($collectionName, $partitionNames) |
Load partitions into memory |
release($collectionName, $partitionNames) |
Release partitions from memory |
Indexes
| Method | Description |
|---|---|
create($collectionName, $indexParams) |
Create an index |
describe($collectionName, $indexName) |
Get index details |
drop($collectionName, $indexName) |
Drop an index |
list($collectionName) |
List all indexes |
Aliases
| Method | Description |
|---|---|
alter($collectionName, $aliasName) |
Alter an alias |
create($collectionName, $aliasName) |
Create an alias |
describe($collectionName, $aliasName) |
Get alias details |
drop($collectionName, $aliasName) |
Drop an alias |
list($collectionName) |
List all aliases |
Entities
| Method | Description |
|---|---|
insert($collectionName, $data, $partitionName) |
Insert data |
upsert($collectionName, $data, $partitionName) |
Insert or update data |
delete($collectionName, $filter, $partitionName) |
Delete data by filter |
get($collectionName, $ids, $outputFields, $partitionNames) |
Get data by primary key |
query($collectionName, $filter, $limit, $offset, $outputFields, $partitionNames) |
Query data by filter |
search($collectionName, $data, $annsField, $limit, $offset, $partitionNames) |
Vector similarity search |
[!NOTE] All methods have full PHPDoc comments with parameter details. For more information on Milvus RESTful API parameters, refer to the Zilliz official documentation.
Notes
- This library is built on Milvus RESTful API v2. Make sure your Milvus / Zilliz Cloud instance supports v2 endpoints.
- Before performing vector search, the collection must have an index created and be loaded into memory (via
load()), otherwise the search will fail. - Default request timeout is 10 seconds. Large data inserts may require batching.
- API Key can be
null(for self-hosted Milvus without authentication), but is required for Zilliz Cloud managed service.
Motivation
I was reading short stories on a novel site that didn't support search and had daily reading limits. Frustrated, I wrote a crawler to download all the stories — but then I couldn't find anything in them locally.
My tiny 2-core 2GB server couldn't run a Milvus instance, but Zilliz Cloud offers a free tier. I run vectorization on my Mac, and use SiliconFlow's free quota for vector queries during search. I just needed a PHP library to tie it all together — and that's how this library came to be.
Contributing
If you find this library useful, give it a ⭐ Star, or submit an Issue / PR to share your ideas.