承接 oramacloud/client 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

oramacloud/client

最新稳定版本:v1.0.2

Composer 安装命令:

composer require oramacloud/client

包简介

Orama Cloud SDK

README 文档

README

Package Version PHP Version Tests

With the OramaCloud PHP Client SDK, you can perform search queries on your Orama index, or programmatically update your index data and trigger new deployments. Integrate Orama Cloud in your PHP application using the REST APIs to insert and upsert your index data and trigger deployments when it's convinient for your use case.

Install

composer require oramacloud/client

Compatibility

PHP: 7.3 or later

Integrating with Orama Cloud

use OramaCloud\Client;
use OramaCloud\Client\Query;

$client = new Client([
    'api_key' => '<Your Orama Cloud API Key>',
    'endpoint' => '<Your Orama Cloud Endpoint>'
]);

$query = (new Query('red shoes'))
    ->where('price', 'gt', 99.99);

$results = $client->search($query);

Advanced search

use OramaCloud\Client;
use OramaCloud\Client\Query;
use OramaCloud\Client\QueryParams/WhereOperator;
use OramaCloud\Client\QueryParams/SortByOrder;

$client = new Client([
    'api_key' => '<Your Orama Cloud API Key>',
    'endpoint' => '<Your Orama Cloud Endpoint>'
]);

$query = new Query();
$query->term('red shoes')
      ->mode('hybrid')
      ->where('price', WhereOperator::LTE, 9.99)
      ->where('gender', WhereOperator::EQ, 'unisex')
      ->sortBy('price' SortByOrder::DESC)
      ->limit(5)
      ->offset(1);

$results = $client->search($query);

Managing your index

use OramaCloud\Manager\IndexManager;

$index = new IndexManager('<Your Index-ID>', '<Your Private API Key>');

// Empty data
$index->empty();

// Insert records
$index->insert([
    ['id' => '1', 'name' => 'John Doe', 'age' => 20 ],
    ['id' => '2', 'name' => 'Mario Rossi', 'age' => 25 ],
    ['id' => '3', 'name' => 'John Smith', 'age' => 35 ],
]);

// Update records
$index->update([[ 'id' => '1', 'name' => 'Jane Doe', 'age' => 30 ]]);

// Delete records
$index->delete(['1', '2']);

// Trigger deployment
$index->deploy();

Run Tests

composer test

License

Apache-2.0 license. Please see License File for more information.

统计信息

  • 总下载量: 359
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2024-07-19