A PHP client for Milvus. This library only supports Milvus 2.x.
composer require mathsgod/milvus-client-php
$client=new Milvus\Client($host, $port);
// Create a collection with 5 dimensions
$client->collections()->create("test_collection",5);
$collection = $client->entities("test_collection");
$collection->insert([
[ "id"=>1, "vector" => [1.0, 2.0, 3.0, 4.0, 5.0] ],
[ "id"=>2, "vector" => [2.0, 2.0, 3.0, 4.0, 5.0] ],
[ "id"=>3, "vector" => [3.0, 2.0, 3.0, 4.0, 5.0] ],
[ "id"=>4, "vector" => [4.0, 2.0, 3.0, 4.0, 5.0] ],
[ "id"=>5, "vector" => [5.0, 2.0, 3.0, 4.0, 5.0] ],
]);
$collection = $client->collection("test_collection");
$collection->load();
// Search for the top 10 vectors that are most similar to the vector [1.0,3.0,3.0,4.0,5.0]
$result = $client->entities("test_collection")->search("vector",[1.0,3.0,3.0,4.0,5.0],10);
$e = $client->entities("test_collection");
$result = $e->query("id in [1,2,3,4,5]");
$e = $client->entities("test_collection");
$e->delete("id in [1]");
$users = $client->users()->list();
$client->users()->create("test_user");
$client->user("test_user")->drop();
$client->user("test_user")->grantRole("admin");
$client->user("test_user")->revokeRole("admin");
$roles = $client->roles()->list();