wisembly/semantria-php

基于 Guzzle 3 的 Semantria API 客户端

0.0.1 2015-04-28 07:22 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:53:31 UTC


README

Semantria API 的 PHP SDK(《http://semantria.com》)。

此 SDK 不是官方的,深受 intercom-php官方 Semantria PHP SDK 启发。

我们开发并维护这个库用于我们自己的用途,并在它可能有所帮助的情况下将其开源(见 LICENCE.md)。Semantria 及其 API 属于 Semantria。

基本用法

记得在你的应用程序中包含 Composer 自动加载器

<?php
require_once 'vendor/autoload.php';

// Application code...

创建客户端时配置你的访问凭证

<?php
use Semantria\SemantriaAuthClient;

$semantria = SemantriaAuthClient::factory(array(
    'consumer_key'      => 'my-consumer-key',
    'consumer_secret'   => 'my-consumer-secret',
    'application_name'  => 'my-app',
    'use_compression'   => false
));

$semantria->addDocument([
    'id'    => 'foo',
    'text'  => 'This method queues document onto the server for analysis. Queued document analyzes individually and will have its own set of results. If unique configuration ID provided, Semantria uses settings of that configuration during analysis, in opposite the primary configuration uses. Document IDs are unique in scope of configuration. If the same ID appears twice, Semantria overrides existing document with the new Data.'
]);

$semantria->getDocument(['document_id' => 'foo']);

测试

运行 bin/phpunit

资源

此 API 支持的资源

许可证

见 LICENCE 文件。