承接 wetrocloud/wetrocloud-sdk 相关项目开发

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

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

wetrocloud/wetrocloud-sdk

Composer 安装命令:

composer require wetrocloud/wetrocloud-sdk

包简介

An easy-to-use SDK that enables integration with the WetroCloud API

README 文档

README

⚠️ Unofficial SDK: This is an unofficial PHP SDK for the WetroCloud API.

Introduction

The WetroCloud SDK for PHP provides an easy way to interact with the WetroCloud API, allowing developers to create collections, insert resources, and query data effortlessly using PHP.

Installation

composer require wetrocloud/wetrocloud-sdk

Quick Start

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

// Initialize the SDK
$wetrocloud = new Wetrocloud('your-api-key');

// Create a collection
$response = $wetrocloud->createCollection('my-collection');

// Insert a resource
$wetrocloud->insertResource('my-collection', 'https://example.com/article', 'web');

// Query the collection
$results = $wetrocloud->queryCollection('my-collection', 'What is this about?');

Available Methods

Collection Management

1. createCollection()

Creates a new collection.

Parameters:

  • ?string $collectionId - (Optional) The unique ID of the collection.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

// Create collection with auto-generated ID
$response = $wetrocloud->createCollection();

// Create collection with custom ID
$response = $wetrocloud->createCollection('unique-collection-id');

echo "Creating Collection: " . json_encode($response, JSON_PRETTY_PRINT);

2. listAllCollections()

Retrieves a list of available collections.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');
$response = $wetrocloud->listAllCollections();

echo "Listing Collections: " . json_encode($response, JSON_PRETTY_PRINT);

3. deleteCollection()

Deletes an entire collection.

Parameters:

  • string $collectionId - The ID of the collection.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');
$response = $wetrocloud->deleteCollection('your-collection-id');

echo "Deleting collection: " . json_encode($response, JSON_PRETTY_PRINT);

Resource Management

4. insertResource()

Inserts a resource into a collection.

Parameters:

  • string $collectionId - The ID of the collection.
  • string $resource - The resource to insert.
  • string $type - The type of resource.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$response = $wetrocloud->insertResource(
    'your-collection-id',
    'https://medium.com/@AlexanderObregon/a-brief-history-of-artificial-intelligence-1656693721f9',
    'web'
);

echo "Insert a resource: " . json_encode($response, JSON_PRETTY_PRINT);

5. removeResource()

Deletes a resource from a collection.

Parameters:

  • string $collectionId - The ID of the collection.
  • string $resourceId - The ID of the resource to delete.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');
$response = $wetrocloud->removeResource('your-collection-id', 'your-resource-id');

echo "Deleting resource: " . json_encode($response, JSON_PRETTY_PRINT);

Querying & Chat

6. queryCollection()

Queries resources from a collection.

Parameters:

  • string $collectionId - The ID of the collection.
  • string $requestQuery - The query string.
  • ?string $jsonSchema - Optional JSON schema.
  • ?string $jsonSchemaRules - Optional JSON schema rules.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$collectionId = 'your-collection-id';
$query = 'What are the sales trends for Q1?';

$response = $wetrocloud->queryCollection($collectionId, $query);

// With schema and rules
$response = $wetrocloud->queryCollection(
    $collectionId,
    $query,
    '{"type": "object", "properties": {"answer": {"type": "string"}}}',
    '{"required": ["answer"]}'
);

echo "Querying resource: " . json_encode($response, JSON_PRETTY_PRINT);

7. chatCollection()

Chat with a collection using message history.

Parameters:

  • string $collectionId - The ID of the collection.
  • string $message - The message to send.
  • ?string $chatHistory - Optional chat history as JSON string.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

// Simple chat without history
$response = $wetrocloud->chatCollection('your-collection-id', 'Tell me more');

// Chat with history
$chatHistory = json_encode([
    ['role' => 'user', 'content' => 'What is this all about?'],
    ['role' => 'assistant', 'content' => 'This is about Queen Elizabeth II of England']
]);

$response = $wetrocloud->chatCollection(
    'your-collection-id',
    'Tell me more',
    $chatHistory
);

echo "Chat with collection: " . json_encode($response, JSON_PRETTY_PRINT);

AI & Content Processing

8. categorizeResource()

Categorizes a resource using predefined categories.

Parameters:

  • string $resource - The resource to categorize.
  • string $type - The type of resource.
  • string $jsonSchema - JSON schema of the resource.
  • string $categories - Comma-separated list of categories.
  • string $prompt - An overall command of your request.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$response = $wetrocloud->categorizeResource(
    'match review: John Cena vs. The Rock',
    'text',
    '{"label": ""}',
    'football,coding,entertainment,basketball,wrestling,information',
    'Where does this fall under?'
);

echo "Categorizing resource: " . json_encode($response, JSON_PRETTY_PRINT);

9. textGeneration()

Generates text without retrieval-augmented generation (RAG).

Parameters:

  • array $messages - Array of message objects with role and content.
  • string $model - The model to use.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$messages = [
    ['role' => 'system', 'content' => 'You are a helpful assistant.'],
    ['role' => 'user', 'content' => 'Write a short poem about technology.']
];

$response = $wetrocloud->textGeneration($messages, 'llama-3.3-70b');

echo "Generation without RAG: " . json_encode($response, JSON_PRETTY_PRINT);

10. imageToText()

Extracts text from an image.

Parameters:

  • string $imageUrl - The URL of the image.
  • string $requestQuery - The query to process the image.

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$imageUrl = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTQBQcwHfud1w3RN25Wgys6Btt_Y-4mPrD2kg&s';
$query = 'What animal is this?';

$response = $wetrocloud->imageToText($imageUrl, $query);

echo "Image to text: " . json_encode($response, JSON_PRETTY_PRINT);

Content Conversion

11. markdownConverter()

Converts a resource (file, web, image) to Markdown.

Parameters:

  • string $resource - The resource URL (file, web page, or image).
  • string $resourceType - The type of resource: "file", "web", or "image".

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

// Convert web page to markdown
$response = $wetrocloud->markdownConverter(
    'https://www.forbes.com/real-time-billionaires/',
    'web'
);

// Convert file to markdown
$response = $wetrocloud->markdownConverter(
    'https://example.com/document.pdf',
    'file'
);

// Convert image to markdown
$response = $wetrocloud->markdownConverter(
    'https://example.com/image.jpg',
    'image'
);

echo "Converted Markdown: " . json_encode($response, JSON_PRETTY_PRINT);

12. transcript()

Retrieves transcript data from a resource (e.g., YouTube video).

Parameters:

  • string $link - The URL of the resource (e.g., YouTube video link).
  • string $resourceType - The type of resource (e.g., "youtube").

Returns: array<string, mixed>

Example:

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

$wetrocloud = new Wetrocloud('your-api-key');

$response = $wetrocloud->transcript(
    'https://www.youtube.com/watch?v=m4qBwGnubew',
    'youtube'
);

echo "Transcript result: " . json_encode($response, JSON_PRETTY_PRINT);

Configuration

Custom Base URL

<?php

use Wetrocloud\WetrocloudSdk\Wetrocloud;

// Use custom API endpoint
$wetrocloud = new Wetrocloud('your-api-key', 'https://custom-api.wetrocloud.com');

HTTP Client Configuration

The SDK uses Guzzle HTTP client with the following default configuration:

  • Timeout: 30 seconds
  • Headers:
    • Authorization: Token your-api-key
    • User-Agent: WetroSDK-PHP/1.0
    • Content-Type: application/json
    • Accept: application/json

Requirements

  • PHP 8.3 or higher
  • Guzzle HTTP Client 7.9 or higher

Testing

Run the test suite using:

./vendor/bin/pest

The test suite uses Pest PHP testing framework.

Support

For additional support, please contact support@wetrocloud.com or visit the website WetroCloud Docs.

License

This SDK is licensed under the MIT License.

Disclaimer

This is an unofficial PHP SDK for the WetroCloud API. It is not officially maintained by WetroCloud and is provided as-is for community use. For official support and documentation, please visit the official WetroCloud documentation.

wetrocloud/wetrocloud-sdk 适用场景与选型建议

wetrocloud/wetrocloud-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 8, 最近一次更新时间为 2025 年 08 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「sdk」 「data extraction」 「rag」 「wetrocloud」 「wetrocloud sdk」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 wetrocloud/wetrocloud-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wetrocloud/wetrocloud-sdk 我们能提供哪些服务?
定制开发 / 二次开发

基于 wetrocloud/wetrocloud-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-18